我的表在MySQL类似如下:集团MySQL表结果送达
| sq | date | title | description |
-----------------------------------
| 10 | 10-06| xxxx | blah blah |
| 09 | 10-06| xxxx | blah blah |
| 08 | 10-06| xxxx | blah blah |
| 07 | 10-06| xxxx | blah blah |
现在我想在降平方米(SQUENCE)的顺序使用PHP在屏幕上显示它们。
我用下面的代码,但它显示了一个错误:
$result = mysql_query("SELECT * FROM posts WHERE (SELECT MAX(sn) FROM posts)");
echo('<ul class="news">');
while($row=mysql_fetch_array($result)) {
$date=$row["date"];
$title=$row["title"];
$description=$row["description"];
echo "<li><strong>$date</strong><h4><a href='#'>$lastname</a></h4>$description</li>";
}
echo('</ul>');
错误消息:
Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in C:\wamp\www\final\index.php on line 99
Call Stack
三和在一个链接向人展示的时间。
在此先感谢。
感谢@DontVoteMeDown [MySQL的\ _fetch \ _array()预计参数1是资源,布尔 – vidya
可能的重复代码的
$result
测试在选择](http://stackoverflow.com/questions/2973202/mysql-fetch-array-expects-parameter-1-to-be-resource-boolean-given-in-select) –请参阅[这个答案]( http://stackoverflow.com/a/11674313/250259)如何解决这个问题。 –