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 type='chinh-sach-khach-hang' order by id desc' at line 1syntax error: select id,ten from table_tags where id IN (select id_tag from table_protag where id_pro=) and type='chinh-sach-khach-hang' order by id desc