0){ $agama=mysql_fetch_object($data_agama); $id_chat_room_pengunjung = $agama->id_chat_room_pribadi; mysql_query("UPDATE chat_room_pribadi SET selesai= 'Belum' WHERE id_chat_room_pribadi = '".$id_chat_room_pengunjung."'"); } else{ $count = mysql_fetch_object(mysql_query("select IFNULL(count(id_chat_room_pribadi), 0) as hitung FROM chat_room_pribadi WHERE DATE(created_date) = DATE(NOW())")); $newRow = $count->hitung+1; $id_chat_room_pengunjung = date('Y-m-d')."_".$newRow; mysql_query("INSERT INTO chat_room_pribadi (id_chat_room_pribadi, email_author, nama_author, email, name, selesai, created_date) VALUES ('".$id_chat_room_pengunjung."','".$emaila."','".$namaa."','".$email."','".$nama."','Belum',now())"); } $data_id_chat_pribadi = mysql_query("select id_chat_room_pribadi FROM chat_room_pribadi WHERE email_author = '".$email."' AND email = '".$emaila."'"); $num_rows = mysql_num_rows($data_id_chat_pribadi); if($num_rows>0){ $agama=mysql_fetch_object($data_id_chat_pribadi); $id_chat_room_pengunjung2 = $agama->id_chat_room_pribadi; mysql_query("UPDATE chat_room_pribadi SET selesai= 'Belum' WHERE id_chat_room_pribadi = '".$id_chat_room_pengunjung2."'"); } else{ $count = mysql_fetch_object(mysql_query("select IFNULL(count(id_chat_room_pribadi), 0) as hitung FROM chat_room_pribadi WHERE DATE(created_date) = DATE(NOW())")); $newRow = $count->hitung+1; $id_chat_room_pengunjung2 = date('Y-m-d')."_".$newRow; mysql_query("INSERT INTO chat_room_pribadi (id_chat_room_pribadi, email_author, nama_author, email, name, selesai, created_date) VALUES ('".$id_chat_room_pengunjung2."','".$email."','".$nama."','".$emaila."','".$namaa."','Belum',now())"); } ?> { "tipe" : "1", "id_chat_room_pengunjung": , "id_chat_room_pengunjung2": }