SELECT ogl.id, ogl.category, ogl.title, ogl.city, ogl.forever, ogl.cost, ogl.cost_notice, ogl.for_free, pay.pay_create, pay.pay_expire FROM oglo2_announcement AS ogl LEFT JOIN oglo2_announcement_payments as pay ON ogl.ident=pay.pay_ident AND pay.pay_type='VIEW' WHERE ogl.category = AND ogl.status = 'ACCEPT' AND ogl.type = '' AND ogl.id <> HAVING pay.pay_expire>='2025-10-28' OR ogl.forever = 'TRUE' ORDER BY ogl.id > DESC, ogl.id ASC Caught exception: Query failed: 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 ogl.status = 'ACCEPT' AND ogl.type = '' AND ogl.id <> HAVING pay.pay_exp...' at line 1 array(3) { [0]=> array(5) { ["file"]=> string(72) "/home/posrednik/domains/posrednik.pl/public_html/classes/mysql.class.php" ["line"]=> int(243) ["function"]=> string(7) "doQuery" ["class"]=> string(5) "MySQL" ["type"]=> string(2) "->" } [1]=> array(5) { ["file"]=> string(92) "/home/posrednik/domains/posrednik.pl/public_html/modules/announcement/announcement.class.php" ["line"]=> int(2644) ["function"]=> string(8) "sqlQuery" ["class"]=> string(5) "MySQL" ["type"]=> string(2) "->" } [2]=> array(5) { ["file"]=> string(86) "/home/posrednik/domains/posrednik.pl/public_html/modules/announcement/announcement.php" ["line"]=> int(456) ["function"]=> string(23) "getNextAnnouncementById" ["class"]=> string(12) "Announcement" ["type"]=> string(2) "->" } }