Unknown column 'library' in 'where clause' - SELECT `portfolio_img`.*, DATE_FORMAT(ultimaModificacao, '%d/%m/%Y %H:%i:%s') as ultimaModificacao2 FROM `portfolio_img` WHERE itemFK = library AND excluido IN ('0','2') ORDER BY ordem ASC