SELECT tP.id as id, tP.name as name, tP.price as price, tP.pic as pic, tP.review as review FROM sc_products tP, sc_orders tOr WHERE tP.id <> AND tP.cat='' AND tP.prodhide=0 GROUP BY tP.id ORDER BY tOr.id DESC LIMIT 9: 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 tP.cat='' AND tP.prodhide=0 GROUP BY tP.id ORDER BY tOr.id DESC LIMIT 9' at line 1