我正在处理以下查询:
$query2 = 'SELECT * FROM user_uploads WHERE id_user = '.$id_user;
我想通过以下方式订购它:ORDER BY upload_id DESC - 但我不知道如何做到这一点,或者在这种特殊情况下将代码放在哪里。
有人可以帮我吗?谢谢
做就是了 :
$query2 = 'SELECT * FROM user_uploads WHERE id_user = '.$id_user.' ORDER BY upload_id DESC';
$query2 = 'SELECT * FROM user_uploads WHERE id_user = '.$id_user.' ORDER BY upload_id DESC;
虽然你可以做
$query2 = "SELECT * FROM user_uploads WHERE id_user = $id_user ORDER BY upload_id DESC";
您绝对应该查看参数化查询。谷歌搜索 PDO!