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 del = 0' at line 161064 SELECT i.*, t.options as opts, c.name as category_name, sc.name as store_category_name, o.name as os_name FROM `CA_inventory` i LEFT JOIN `CA_inventory_types` t ON i.type_id = t.id LEFT JOIN `CA_inventory_categories` c ON c.id = i.category_id LEFT JOIN `CA_inventory_os` o ON o.id = i.os_id LEFT JOIN `CA_store_categories` sc ON sc.id = i.store_category_id WHERE i.id = {uri} AND del = 0