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 p.item_id = pc.item_id and p.artist_id = a.ArtistID and p.is_active = 'yes' ' at line 1