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 TB_PUBBLICAZIONI.ID_PUBBL=306) ORDER BY TB_PUBBL_FOTO.POSIZIONE_PUBBL' at line 1