"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 file_status = '0' ORDER BY file_priority' at line 3" :: SELECT * FROM cms_products_files WHERE products_id = AND file_status = '0' ORDER BY file_priority ASC