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 'and cp.id_producto<1917 and p.publicar_producto=1 and p.id_producto no' at line 4