2017-12-31Query: select docs.*, CASE docs.tipofoto WHEN 'image/png' then 'image' WHEN 'image/jpg' then 'image' WHEN 'image/gif' then 'image' WHEN 'image/jpeg' then 'image' ELSE 'file' END as display from FOTOS AS docs WHERE id_proyecto= 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 15