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 'or `enabled` = 0 and city2 = ORDER BY id desc LIMIT 0,2' at line 1; Query: SELECT * FROM `md_news` where `enabled` = 0 and city = or `enabled` = 0 and city2 = ORDER BY id desc LIMIT 0,2