Unable to execute query select a.artist_name, c.folder_name, c.category_name, l.artist_id, l.category_id, l.list_name, l.version from artist a, artist_category as c, artist_category_list as l where a.artist_id=l.artist_id and (c.category_id=l.category_id or l.category_id=0 ) and list_id= because 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 '' at line 1