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 'LIMIT 0, 18' at line 1(No Description) sql: SELECT DISTINCT(p.id), p.*, IF(p.salesrank <> 0, p.salesrank, 100000) AS salesrank FROM products p, product_tags t WHERE p.id = t.product_id AND p.parent_id = 0 AND t.tag_id = '2455' AND hidden = 0 AND enabled = 1 AND (p.price > 0 AND p.price <= 0) ORDER BY LIMIT 0, 18