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