<?php
mysql_select_db("mgshuheb") or die("No such database");
$str = "SELECT * FROM posts ORDER BY id DESC";
$rs = mysql_query($str);
while($row = mysql_fetch_array($rs)) {
echo '<span class="name">' . $row["name"] . '</span>'."<br />";
echo $row["post"] . "<br />";
echo $row["time"] . "<br /><br />";
}
?>
这是我现在所拥有的。当我输入SELECT TOP 50 * FROM posts ORDER BY id DESC;
时,它会不断出现错误。
答案 0 :(得分:3)
在MySQL中,使用limit
代替top
:
SELECT *
FROM posts
ORDER BY
id DESC
LIMIT 50
答案 1 :(得分:0)
您必须对查询设置限制
<?php
$str = "SELECT * FROM posts ORDER BY id DESC LIMIT 0,50";
?>