You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'AND a.id_categoria=12 AND a.scadenza>'2020-11-23 17:42:53' AND a.pubblica=3 AND ' at line 3