SELECT DISTINCT * FROM mr3_parts WHERE type_ = 4 AND p_id = AND show_cat = 1 AND l = '8' AND secure = '0' ORDER BY RAND() LIMIT 0, 3 : 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 show_cat = 1 AND l = '8' AND secure = '0' ORDER BY RAND() ' at line 5