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 stt desc' at line 1syntax error: select thumb,photo from table_album where id_photo= order by stt desc