SELECT tP.id as id, tP.name as name, tP.review as country, tP.price as price, tP.discountprice AS discount, tP.pic as pic FROM sc_products tP, sc_orders tOr WHERE tOr.product=tP.id AND tP.id <> AND tP.cat='' GROUP BY tP.id ORDER BY tOr.id,price ASC LIMIT 8: 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='' GROUP BY tP.id ORDER BY tOr.id,price ASC LIMIT 8' at line 1