member_1."' UNION SELECT nama_sekolah from sekolah where paket!='Free' and email_daftar='".$row->member_1."' UNION SELECT nama from sekolah_siswa where email='".$row->member_1."' UNION SELECT nama_guru from sekolah_guru where email='".$row->member_1."' and status_guru='Aktif'")); $query_name_2 = mysql_fetch_object(mysql_query("SELECT nama from admin where email='".$row->member_2."' UNION SELECT nama_sekolah from sekolah where paket!='Free' and email_daftar='".$row->member_2."' UNION SELECT nama from sekolah_siswa where email='".$row->member_2."' UNION SELECT nama_guru from sekolah_guru where email='".$row->member_2."' and status_guru='Aktif'")); $display_name_1 = $query_name_1->nama; $display_name_2 = $query_name_2->nama; } else if($type == 2) { $display_name_1 = $row->member_1; $display_name_2 = $row->member_2; } $chat_list[] = array( "chat_room_id" => $row->id, "member_1" => $row->member_1, "display_name_1" => $display_name_1, "member_2" => $row->member_2, "display_name_2" => $display_name_2, "last_message" => $row->last_message ); } } $data = array("chat_list" => $chat_list); echo json_encode($data, JSON_PRETTY_PRINT); } ?>