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 abilitata='1' and visibile='1' and abilitata=1 AND id_padre=9 ORDER BY rand(' at line 1select *, menu.id as id_item from menu inner join menu_lingue on menu.id=menu_lingue.id_menu where id_lingua= and abilitata='1' and visibile='1' and abilitata=1 AND id_padre=9 ORDER BY rand()