SELECT SQL_CALC_FOUND_ROWS stock.id AS stock_id, IFNULL(image_s2,CONCAT(stock.id,'-s2.jpg')) AS thumb, title, sale_status AS sold, price, artist.name FROM stock, artist WHERE artist_id = AND artist.id = stock.artist_id AND stock.deleted = 0 ORDER BY FIELD(sale_status,'S','R', 'A'), stock.id LIMIT 0,9You 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 artist.id = stock.artist_id AND stock.deleted = 0 ORDER BY FIELD(sale_st' at line 7