whats wrong with this query..
Posted: Thu Jan 24, 2008 8:27 am
hello friends i have a join query for search the query is as follows : - >
but when i search by the login or email or by name than it gives muyltiple records equal to the countries in my country table
please let me know whats wrong with this query ...
Code: Select all
$sql_search="select a.*,b.*,c.* from users as a,students as b, cm_countries as c where (a.login like '%".$search."%' or a.name like '%".$search."%' or a.mail like '%".$search."%' or a.city like '%".$search."%') or (c.country like '%".$search."%'and a.country=c.country_id) and a.id=b.student_id and user_type!=1 and b.teacher_id=$userid";
please let me know whats wrong with this query ...