我想在WHERE子句之后使用ORDER BY来命令我的结果。
我试过这样的事情:
$queryl = "select * from logs where pid=".$rowcd['id']. "order by bottom desc";
它给了我Fatal error: Call to a member function fetch_assoc()
。
没有ORDER BY我的查询工作正常:
$queryl = "select * from logs where pid=".$rowcd['id'];
答案 0 :(得分:2)
$queryl = "select * from logs where pid=".$rowcd['id']. " order by bottom desc";
在双引号和订单后添加空格
“订单
答案 1 :(得分:0)
在ORDER BY
子句之前放置一个空格。
$queryl = "select * from logs where pid = {$rowcd['id']} order by bottom desc";
答案 2 :(得分:0)
我有时会遇到空格问题。我认为在order关键字之前必须有空格。
$queryl = "select * from logs where pid=".$rowcd['id']. " order by bottom desc";