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 '1,1523,1524,1661,1525,1716,1529,1530,1531,1532,1533,1725,1535,1536,1537,1538,153' at line 3 SQL query : SELECT i.filename, p.* FROM SS_products p LEFT JOIN SS_product_pictures i on p.default_picture=i.photoID WHERE p.categoryID IN(,1,1523,1524,1661,1525,1716,1529,1530,1531,1532,1533,1725,1535,1536,1537,1538,1539,1540,1541,1743,1587,1594,1719,1720,1721,1722,1723,1724,1599,1600,0,1619,1633,1634,1635,1636,1637,1622,1642,1643,1644,1645,1601,1620,1627,1628,1629,1630,1631,1632,1602,1603,1604,1621,1638,1639,1640,1641,1772,1605,1616,1646,1748,1554,1560,1561,1482,1562,1485,1574,1481,1584,1483,1746,1717,1727,1745,1596,1668,1555,1588,1611,1612,1811,1589,1590,1808,1809,1814,1617,1618,1810,1669,1670,1671,1672,1673,1735,1674,1675,1676,1677,1678,1679,1680,1766,1767,1768,1681,1682,1683,1728,1685,1742,1684,1777,1778,1779,1780,1781,1782,1686,1548,1578,1730,1731,1795,1796,1556,1491,1494,1774,1775,1776,1729,1783,1784,1785,1786,1787,1788,1583,1789,1790,1791,1792,1793,1606,1690,1658,1706,1707,1769,1747,1757,1758,1759,1760,1761,1762,1763,1593,1764,1765,1770,1771,1710,1711,1714,1749,1754,1755,1756,1575,1565,1576,1577,1591,1805,1585,1520,1549,1718,1559,1586,1595,1708,1812,1607,1608,1449,1450,1456,1457,1459,1452,1460,1461,1462,1463,1464,1465,1466,1467,1773,1453,1454,1455,1468,1451,1458,1484,1592,1664,1563,1800,1802,1803,1804,1813,1573,1659,1552,1660,1665,1738,1739,1794,1666,1667,1736,1737,1799,1798,1431,1432,1433,1434,1435,1436,1437,1438,1624,1625,1439,1440,1441,1442,1623,1443,1444,1626,1445,1446,1447,1448,1597,1598,1662,1545,1652,1653,1654,1656,1806,1807,1550,1647,1648,1649,1650,1564,1582,1551,1568,1566,1571,1572,1569,1657,1688,1522,1546,1553,1655,1692,1693,1694,1695,1696,1697,1698,1699,1700,1701,1733,1734,1740,1702,1732,1703,1704,1726,1750,1751,1709,1715,) AND p.enabled=1 ORDER BY p.Price LIMIT 1