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 ')' at line 1 SQL query : select count(*) from SS_discussions_new WHERE categoryID='2058' OR productID IN (21903,21904,73769,21905,21906,21908,21909,73770,21910,21912,21913,21914,21915,21916,21917,21918,21919,21920,21921,21922,21923,21924,21925,21926,21927,21928,21929,21930,21931,21935,21936,21937,21938,21939,21940,45313,45314,45315,21932,21933,73687,73688,73689,73692,73693,73694,73695,73696,45311,)