SELECT * FROM product_link L JOIN product P ON (L.product_id = P.product_id) WHERE L.product_category_id = '2' AND L.order_id < AND P.is_enable = 1 ORDER BY L.order_id DESC 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 'AND P.is_enable = 1 ORDER BY L.order_id DESC' at line 1 /var/www/clients/client28/web279/web/class/product.class.php 1329