Jump to content

A SQL syntax error : not understandable


daxguy

Recommended Posts

I have a search box which uses multiple query depending on the search criteria

the following queries work just fine

select * from `car_post` where `approve` = '1' and `caru_city` = '2'

 

select * from `car_post` where `approve` = '1' and `caru_make` = '7' and `caru_city` = '2'

 

These queries mentioned above work just fine.. but i want the results to show the latest entries in the table so write the query as

select * from `car_post` where `approve` = '1' and `caru_make` = '7' and `caru_city` = '2' ORDER BY caru_id DESC

 

This query works perfectly fine in the SQL client.. it gives the results there... but as i am using it on my page.. by just adding

ORDER BY caru_id DESC

 

The query gives the following error

 

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 'DESCLIMIT 0, 10' at line 1

 

I dont understand if the query is working all fine in the sql client directly why isnt it working here?

Link to comment
https://forums.phpfreaks.com/topic/274615-a-sql-syntax-error-not-understandable/
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.