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 'order by data_ord asc' at line 1select *, as id_item from categorie inner join categorie_lingue on where id_lingua=1 and abilitata='1' and visibile='1' and id_padre= order by data_ord asc