You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'LIMIT 0, 18' at line 14(No Description) sql: SELECT DISTINCT (p.id), IF(p.salesrank <> 0, p.salesrank, 100000) AS salesrank, p.price, p.averagescore, p.linktitle, 'product' AS type FROM products p, products_categories c WHERE p.id = c.product_id AND p.parent_id = 0 AND c.category_id = 28 AND hidden = 0 AND enabled = 1 AND offers > 0 AND 1 = 1 UNION SELECT DISTINCT (p.id), IF(p.salesrank <> 0, p.salesrank, 100000) AS salesrank, p.price, p.averagescore, p.linktitle, 'bundle' AS type FROM bundles p, bundle_categories c WHERE p.id = c.bundle_id AND c.category_id = 28 AND disabled = 0 AND offers > 0 AND 1 = 1 ORDER BY LIMIT 0, 18