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 'd-6b55-6380e2e86b38.jpg = 1) AND tipo IN (23) AND provincia IN (460) order by ' at line 1 Error en buscarLibre. Consulta: select * from m_inmuebles where terminado=1 and estadoOp='Activo' and visible_web=1 AND (finca-rustica-en-venta-78000-euros-las-rozas-de-madrid-zona-marazuela-el-torreon_thumb49fb23ac-722f-2e3d-6b55-6380e2e86b38.jpg = 1) AND tipo IN (23) AND provincia IN (460) order by escaparate desc, finca-rustica-en-venta-78000-euros-las-rozas-de-madrid-zona-marazuela-el-torreon_thumb49fb23ac-722f-2e3d-6b55-6380e2e86b38.jpg desc, tipo asc, fecha desc, id