select * from category main, category_lang c where 1=1 and main.identifier='product' and main.id= and main.status = 1 and main.id=c.main_id and c.lang_id = '1' order by main.order_no asc 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 main.status = 1 and main.id=c.main_id and c.lang_id = '1' order by main....' at line 1