SELECT IFNULL(image_s4,CONCAT(,'-s4.jpg')) AS image, CONCAT(,'-s5.jpg') AS s5image, title, m.media_desc as media, name, price,, dimensions, sale_status, artist_id, CONCAT(UPPER(LEFT(,1)),'P', AS catno FROM stock LEFT JOIN mediatype AS m ON = stock.media_type LEFT JOIN artist AS artist ON = stock.artist_id LEFT JOIN country AS c ON = artist.nationality WHERE = 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 8