syantax error using php mysql and inner join -


i have query searching using inner join browser display syntax message error

20you have error in sql syntax; check manual corresponds mysql server version right syntax use near '= '' or village = '')' @ line 17

can tel me wrong query???

query:

$sql = mysql_query("select user_id,first_name, last_name, birth_date, registered_date,      s.specialization_name,     g.governorate_name,     d.district_name,     v.village_name            members u                        inner join  specialization s                          on u.specialization = s.specialization_id                         inner join governorate g                         on u.governorate = g.governorate_id                         inner join districts d                         on u.district = d.district_id                         inner join village v                         on u.village = v.id                        (governorate = ''or governorate = '$bygov') or                              (district = '' or district = '$bydist') or                              (village = '' or village = '$byvillage')")                              or die(mysql_error()); 

you need quote strings:

$sql = mysql_query("select user_id,first_name, last_name, birth_date, registered_date,      s.specialization_name,     g.governorate_name,     d.district_name,     v.village_name            members u                        inner join  specialization s                          on u.specialization = s.specialization_id                         inner join governorate g                         on u.governorate = g.governorate_id                         inner join districts d                         on u.district = d.district_id                         inner join village v                         on u.village = v.id                        ('$bygov' = '' or governorate = '$bygov') ,                              ('$bydist' = '' or district = '$bydist') ,                              ('$byvillage' = '' or village = '$byvillage')")                              or die(mysql_error()); 

Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

CSS3 Transition to highlight new elements created in JQuery -