You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'LIMIT 36, 18' at line 10(No Description) sql: SELECT * FROM products p WHERE enabled = 1 AND parent_id = 0 AND hidden = 0 AND salesrank <> 0 AND 1 = 1 AND id IN (20631,20486,23823,9508,25104,24946,20078,2759,14554,1510,1493,6038,9355,22617,24369,25069,3410,23847,1540,23561,24551,17012,9473,5533,20323,1671,1703,3022,19209,1503,2172,17103,1691,24256,1726,1673,7955,17727,3460,23155,1444,4021,6219,6329,23531,20153,8022,17896,3102,20756) ORDER BY LIMIT 36, 18