Jump to content

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.