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='3973' OR productID IN (32285,32286,32287,32289,32290,32292,32293,32294,32295,32297,32298,32300,32301,32303,32304,32306,32307,32309,32310,32312,32313,32314,32315,32317,32318,32319,32320,32322,32323,54673,54674,54675,54676,54677,46394,46395,32359,32360,32361,32363,32364,32366,32367,32368,32369,32371,32372,32374,32375,32377,32378,32380,32381,32384,32385,32387,32389,54678,32390,32391,32392,32393,32394,32395,32396,32397,32398,32399,32400,32401,32402,32403,32404,32405,32406,32407,32408,54679,32409,54680,32410,32411,32412,32413,54681,54682,32414,32415,32416,32417,46396,32418,32419,32420,46336,46337,46346,46347,46348,46349,46350,46351,46352,46353,46354,46359,46360,46361,46362,46367,46368,46369,54380,54381,54382,66421,66422,66423,66424,66428,66429,66430,66434,46334,46335,)