按ID排序查询

时间:2013-04-20 21:10:26

标签: php mysql

我正在处理以下问题:

$query2 = 'SELECT * FROM user_uploads WHERE id_user = '.$id_user;

我想订购它:ORDER BY upload_id DESC - 但我仍然坚持如何做到这一点,或者将代码放在这个特殊情况下的位置。

是的,有人能帮帮我吗? 感谢

3 个答案:

答案 0 :(得分:1)

只是做:

$query2 = 'SELECT * FROM user_uploads WHERE id_user = '.$id_user.' ORDER BY upload_id DESC';

答案 1 :(得分:0)

$query2 = 'SELECT * FROM user_uploads WHERE id_user = '.$id_user.' ORDER BY upload_id DESC;

答案 2 :(得分:0)

虽然你可以做到

$query2 = "SELECT * FROM user_uploads WHERE id_user = $id_user ORDER BY upload_id DESC";

你一定要查看参数化查询。 Google for PDO!