SELECT COUNT(id) FROM (SELECT ogl.id, ogl.ident, ogl.title, ogl.category, ogl.city, ogl.city_rw, ogl.district, ogl.state, ogl.country, ogl.cost, ogl.cost_notice, ogl.cost_currency, ogl.for_free, ogl.status, ogl.display, ogl.forever, ogl.urgent, ogl.create_date, ogl.whole_country, ogl.delivery_enabled, ogl.delivery_info, MAX(CASE WHEN pay.pay_type = 'VIEW' THEN pay.pay_expire ELSE NULL END) AS view_till, MAX(CASE WHEN pay.pay_type = 'PROMOTED' AND pay.pay_expire >= '2026-05-24' THEN pay.pay_expire ELSE NULL END) AS promoted_till FROM oglo25_announcement AS ogl LEFT JOIN oglo25_announcement_payments AS pay ON ogl.ident=pay.pay_ident LEFT JOIN oglo25_company AS comp ON comp.company_id = ogl.company_id WHERE ogl.status='ACCEPT' AND ogl.display = 'TRUE' AND (((pay.pay_create <= '2026-05-24' OR pay.pay_create IS NULL) AND pay.pay_expire >= '2026-05-24') OR ogl.forever = 'TRUE') AND ogl.category IN () GROUP BY ogl.id ) AS x Caught exception: 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 ') GROUP BY ogl.id ) AS x' at line 1 array(5) { [0]=> array(5) { ["file"]=> string(71) "/home/angolia/domains/angolia.co.uk/public_html/classes/mysql.class.php" ["line"]=> int(249) ["function"]=> string(7) "doQuery" ["class"]=> string(5) "MySQL" ["type"]=> string(2) "->" } [1]=> array(5) { ["file"]=> string(71) "/home/angolia/domains/angolia.co.uk/public_html/classes/mysql.class.php" ["line"]=> int(593) ["function"]=> string(8) "sqlQuery" ["class"]=> string(5) "MySQL" ["type"]=> string(2) "->" } [2]=> array(5) { ["file"]=> string(72) "/home/angolia/domains/angolia.co.uk/public_html/classes/avatec.class.php" ["line"]=> int(593) ["function"]=> string(14) "sqlCountSimple" ["class"]=> string(5) "MySQL" ["type"]=> string(2) "->" } [3]=> array(5) { ["file"]=> string(91) "/home/angolia/domains/angolia.co.uk/public_html/modules/announcement/announcement.class.php" ["line"]=> int(2880) ["function"]=> string(8) "paginate" ["class"]=> string(6) "kernel" ["type"]=> string(2) "->" } [4]=> array(5) { ["file"]=> string(85) "/home/angolia/domains/angolia.co.uk/public_html/modules/announcement/announcement.php" ["line"]=> int(242) ["function"]=> string(30) "userSearchAnnouncementStandard" ["class"]=> string(12) "Announcement" ["type"]=> string(2) "->" } }