error in sql syntax

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
m2babaey
Forum Contributor
Posts: 364
Joined: Sun May 20, 2007 9:26 am

error in sql syntax

Post by m2babaey »

i used this code:

Code: Select all

$sql="SELECT l.id lid, l.advertiser_id advertiser, l.title title, l.url url, l.displayurl display, l.description desc, l.adult adult, l.keywords keywords, l.maxb maxb, a.id id, a.balance balance FROM listing l ,advertiser a WHERE keywords LIKE '%$keyword%' and balance > 5 and advertiser=lid ORDER BY maxb DESC  LIMIT $lim ";
my purpose is the topic i opened before (selecting from more than 1 table)
it says:
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 'desc, l.adult adult, l.keywords keywords, l.maxb maxb, a.id id,
where i am wrong?
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

"desc" is a reserved word.
Post Reply