Page 1 of 1

error in sql syntax

Posted: Mon Aug 27, 2007 10:35 pm
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?

Posted: Mon Aug 27, 2007 10:36 pm
by feyd
"desc" is a reserved word.