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='3960' OR productID IN (30467,30468,30469,30470,30471,30472,30473,30474,30475,30476,30477,30478,30479,30480,30481,30482,30483,30484,30485,30486,30487,30488,30489,30490,30491,30492,30493,30494,30495,54523,54524,54525,54526,54527,45663,45664,30520,30521,30522,30523,30524,30525,30526,30527,30528,30529,30530,30531,30532,30533,30534,30535,30536,30538,30539,30540,54528,30542,30543,30544,30545,30546,30547,30548,30549,30550,30551,30552,30553,30554,30555,30556,30557,30558,30559,30560,30561,54529,30562,54530,30563,30564,30565,30566,54531,54532,30567,30568,30569,30570,45665,30571,30572,30573,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,)