You have an error in your SQL syntax

Avatar
  • Answered
Iam facing this problem with my code, how to fix it..

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'and v.CityID= and v.Availability='1'' at line 1error in select v.*,a.AgencyName,a.Email,a.Mobile,c.CityName,t.Type from vehicles v left join agencies a on a.AgencyID = v.AgencyID left join cities c on c.CityID = v.CityID left join vtype t on t.VtypeID = v.VtypeID where v.VtypeID= and v.CityID= and v.Availability='1'
Avatar
Scott
Hello Lucky, Sorry to hear about your SQL syntax error. These are not usually very hard errors to fix, though the cause can be one of a few things. We have an article on the MySQL 1064 Syntax error that you may want to look at. It goes over the most common causes of the error. As you did not provide the entire SQL Query, I can only tell you to look at the query where the 'and v.CityID' part starts. Either that portion or the portion just before it is the cause of the error. Match that against the suggestions in the article and you should be able to correct it. Kindest Regards, Scott M