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='4194' OR productID IN (43523,43524,43525,43526,43527,43528,43529,43530,43533,43534,43535,43536,43537,43538,43539,43540,43541,43544,43545,43546,43547,43548,43549,43550,43551,43552,43555,43556,43557,43558,43559,43560,43561,43562,43563,43564,43565,43566,66410,66411,66412,66413,66414,66415,66416,66417,66418,66419,66420,43468,43469,43470,43471,43472,43473,43474,43475,43476,43477,43478,43479,43480,43481,43482,43483,43484,43485,43486,43487,43488,43489,43490,43491,43492,43493,43494,43495,43496,43497,43499,43500,)