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 'AND sp.enabled = 1
UNION ALL
SELECT sp1.p' at line 12
SELECT
*
FROM
`SC_reviews` as rev,
`SC_products` as prod,
`SC_product_pictures` as pics
WHERE
rev.productID IN (
SELECT sp.productID FROM `SC_products` sp
INNER JOIN `SC_category_product` scp ON sp.productID = scp.productID
WHERE scp.categoryID =
AND sp.enabled = 1
UNION ALL
SELECT sp1.productID FROM `SC_products` sp1
WHERE sp1.categoryID =
AND sp1.enabled = 1
)
AND rev.enabled = 1
AND prod.productID=rev.productID
AND prod.default_picture=pics.photoID
AND prod.productID=pics.productID
ORDER BY
`review_date` DESC
LIMIT
4