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