There is an error on the SQL command.

SQL:
SELECT * FROM fbz_fotos WHERE imovel= ORDER BY principal DESC, id asc LIMIT 0,1

Error:
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 'ORDER BY principal DESC, id asc LIMIT 0,1' at line 3