我正在从服务器获取数据。我希望该用户只能得到表格中的最后5条记录。如何从我的sql表中选择最后5条记录
这是我目前使用的查询;它不工作:
$query = mysql_query("
SELECT
ml.PostID,
ml.UserID,
ml.PostDate,
ml.PostTime,
ml.PostCategory,
ml.PostSubCategory,
ml.PostComments,
cat.UserName
FROM UserPosts AS ml
LEFT JOIN UserNames cat
ON cat.UserID = ml.UserID
ORDERD BY DESC LIMIT 5");
给出以下错误
警告:mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in /home/content/i/h/u/ihus235/html/cs/pah_brd_v1/productivo/getPosts.php on line 77
你想按哪个列排序? – chetan
@chetan我想得到所有的数据没有任何列 –
我的意思是你有ORDER BY DESC子句。但是您错过了列排序 – chetan