Jump to content

Query Is Not Working Properly...


thara

Recommended Posts

$q = "SELECT keyword, col, city_name, image_name, tutor_code 
           FROM (
               SELECT tutor_name AS keyword, 'Tutors' AS col, IFNULL(c1.city_name, '') city_name, IFNULL(ti.image_name, '') image_name, tutor_code FROM tutors AS t
               LEFT JOIN address a ON t.address_id = a.address_id
               LEFT JOIN city c1 ON a.city_id = c1.city_id 
               LEFT JOIN tutor_images ti ON t.tutor_id = ti.tutor_id 
               WHERE ti.image_type = 'profile'
               UNION
               SELECT subjects AS keyword, 'Subject' AS col, '' city_name, '' image_name, '' tutor_code FROM subject
               UNION
               SELECT city_name AS keyword, 'City' AS col, '' city_name, '' image_name, '' tutor_code FROM city
               UNION
               SELECT institute_name AS keyword, 'Institute' AS col, '' city_name, '' image_name, '' tutor_code FROM institutes
           ) s
         WHERE keyword LIKE '%$queryString%' 
         LIMIT 10";

 

this query display a list with subjects, tutor names, cities and institutes according the keyword. This is working but If tutors dont have a profile image those tutors not display in the list.. can anybody you tell me why is it?

 

Thanks

Link to comment
https://forums.phpfreaks.com/topic/271242-query-is-not-working-properly/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.