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 'd913db.jpg = 1) AND tipo IN (21, 25, 22, 26, 14, 2, 24) AND provincia IN (460) ' at line 1 Error en buscarLibre. Consulta: select * from m_inmuebles where terminado=1 and estadoOp='Activo' and visible_web=1 AND (_thumbad650f5b-1248-157a-518e-631720d913db.jpg = 1) AND tipo IN (21, 25, 22, 26, 14, 2, 24) AND provincia IN (460) order by escaparate desc, _thumbad650f5b-1248-157a-518e-631720d913db.jpg desc, tipo asc, fecha desc, id