2SELECT * FROM articoli WHERE ( and (old!=1 and salart=1 and datven <= 1542231410)) order by categoria asc +++ Query 11 non valida: 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 (old!=1 and salart=1 and datven <= 1542231410)) order by categoria asc' at line 1