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 tipo_fk = 1 AND excluido IN ('0','2') ORDER BY ordem ASC' at line 1 - SELECT `banner`.*, DATE_FORMAT(data_cadastro, '%d/%m/%Y %H:%i:%s') as data_cadastro2,DATE_FORMAT(data_alteracao, '%d/%m/%Y %H:%i:%s') as data_alteracao2 FROM `banner` WHERE page_fk = AND tipo_fk = 1 AND excluido IN ('0','2') ORDER BY ordem ASC