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-b469-4396-654b7b8623a0.jpg = 1) AND tipo IN (8) AND provincia IN (460) order' at line 1 Error en buscarLibre. Consulta: select * from m_inmuebles where terminado=1 and estadoOp='Activo' and visible_web=1 AND (edificio-en-venta-1250000-euros-las-rozas-de-madrid-zona-estacion_thumb65256194-6e3d-b469-4396-654b7b8623a0.jpg = 1) AND tipo IN (8) AND provincia IN (460) order by escaparate desc, edificio-en-venta-1250000-euros-las-rozas-de-madrid-zona-estacion_thumb65256194-6e3d-b469-4396-654b7b8623a0.jpg desc, tipo asc, fecha desc, id