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 '-30,30' at line 1 in SELECT * FROM ads WHERE in_cat_sub='446' AND id NOT IN ('6','10','575','36','15','1200','47','49','51','59','4873','4874','4859','65','71','78','82','7141','6632','92','93','95','96','117','124','127','130','131','134','136','137','148','152','154','167','178','196','199','202','204','205','209','210','216','1028','232','242','263','265','266','272','275','9923','9784','9786','280','281','282','1749','287','291','293','330','339','347','360','365','375','390','391','393','395','396','397','399','401','402','403','405','406','407','6688','409','413','416','432','433','10592','440','448','450','451','454','457','458','459','468','469','2010','487','488','7381','492','493','494','10130','498','499','510','514','516','7222','7225','526','528','530','532','534','542','544','5282','557','559','569','573','577','578','1274','587','6728','600','609','611','613','615','616','4970','623','626','629','630','637','638','639','640','1058','5188','660','675','676','678','679','689','692','723','731','732','747','753','757','758','5281','764','769','772','775','776','780','789','790','794','795','796','797','798','812','821','832','834','1312','1313','840','5004','843','848','853','858','2130','864','872','890','903','904','914','916','1279','1344','1280','922','923','6697','943','944','961','963','964','966','969','989','994','996','5143','5186','1036','1037','6730','1041','1052','1053','1056','1057','1059','1154','1064','1065','6648','1082','1086','1089','1090','8919','1181','1115','1117','1248','1249','1438','1127','1141','1142','1146','1147','1150','1151','5118','1155','1159','1167','1168','1169','1177','1178','1183','1185','4532','1188','1190','1193','1206','1199','2100','1205','1208','1210','1211','1212','1213','1217','1221','1222','1223','1224','1225','9760','1228','1232','1234','1259','1262','10540','6553','1287','1290','1295','1302','4894','4901','4908','4920','1305','4822','1381','1306','6508','12951','1308','1310','1314','1315','1316','1317','1322','1323','1324','1325','1326','1327','1328','5307','1535','1359','1346','1331','1333','1334','1335','1336','1337','1339','1340','1341','1342','1352','1353','1355','1361','1362','1364','1365','1367','1368','1370','1373','1407','1376','1377','1378','1386','1387','1388','1389','1390','1391','1394','1395','1396','1399','1400','1401','1402','1403','1404','1406','1421','1420','1423','1424','1427','1431','1432','1433','1436','1435','1442','1443','1444','1448','1449','1450','1451','1456','1458','1460','1462','1467','1469','1470','1473','6683','1479','1495','1496','1502','1503','1508','1509','4563','1523','1524','1525','4568','1528','1530','1531','1538','1539','1540','1548','1549','1556','1557','1559','1560','1561','1562','1563','1564','1565','1567','1569','1570','1571','1576','1577','1584','1586','1589','1591','1595','1601','1599','1600','1602','1606','1607','1608','1609','1610','1612','1626','1629','1630','1633','1634','3862','2166','1871','4954','1640','1642','1647','1648','1653','4953','2103','1657','1659','1661','1663','1664','1674','1675','1676','1678','1679','1680','1685','1689','1898','1696','1697','1699','1702','1705','1707','1708','1709','1710','1724','1725','1726','1729','1730','1731','1732','1733','1742','7458','7434','1750','1751','1752','1753','1759','1763','1764','2105','1771','1774','1775','1776','1779','1790','1792','1799','1800','1801','1810','1811','1815','1816','1817','1828','1850','1851','1865','1867','1868','1873','1877','1895','1897','1916','1913','1920','1930','1929','1931','1946','1949','1953','1954','1973','1981','1982','1985','1992','2000','2002','2030','2200','2084','2085','2099','2101','2102','2106','2122','2126','2133','2139','2142','2174','2204','2205','2206','2207','2208','2209','2210','2229','2289','2341','2342','2345','2392','2393','2440','2467','2483','2493','2523','2569','2589','2593','2595','2611','2629','2633','2634','2656','2657','2663','2734','2779','2784','2788','2811','2831','2839','2867','2870','3036','3094','3107','3109','3111','3114','3125','3126','3133','3135','3136','3150','3204','3209','3218','3234','3265','3275','3279','3292','3309','3310','3311','3312','3313','3328','3329','3363','3374','3403','3410','3415','3419','3420','3427','3435','3464','3465','3474','3497','5006','5076','5040','5062','3524','3532','3541','3580','3587','3588','3616','3650','3653','3665','3681','3684','3710','3722','3724','3735','3746','3748','3758','3771','3779','3780','3781','3805','3818','3897','3898','3912','3922','3925','3933','3936','3940','3952','3996','4017','4018','4062','4089','4163','4221','4309','4390','4415','4424','4462','4488','4510','4511','4514','4550','6229','6653','4744','5065','4858','4678','4679','4684','4715','4951','6622','4791','4753','4720','4722','5224','5309','5362','5386','5397','5398','5436','5466','5560','5609','5610','5645','5657','5664','5665','5679','5682','5740','5741','5742','5743','5881','5883','5924','6179','5952','5953','5991','6045','6049','6052','6073','6125','6288','6373','6377','6384','6385','6422','6430','6513','6523','6543','6567','6753','6770','6780','6794','6815','6816','6845','6871','6888','6915','6931','6953','6965','6966','6976','6977','7012','7029','7155','7193','7218','7232','7251','7254','7256','7428','7453','7454','7472','7565','7574','7607','8042','7697','7745','7750','7754','7887','7915','7985','8139','8183','8222','8228','8259','8277','8317','8329','8412','8415','8416','8448','8494','8530','11385','8590','8605','8667','8669','8725','8787','8844','8845','8857','8858','8966','8975','8985','8986','9067','9072','9094','9098','9114','9134','9207','9308','9312','9420','9451','9507','9510','9627','9733','9765','9772','9776','10035','10051','10075','10078','10081','10184','10387','10489','10494','10610','10611','10678','10680','10681','10746','10763','10852','10866','11150','11273','11416','11515','11911','12227','12815','12817','13149') AND tp='2' ORDER BY vip DESC, id DESC LIMIT -30,30