-3
    <?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;它不断出现错误。

4

2 回答 2

3

在 MySQL 中,使用limit代替top

SELECT  * 
FROM    posts 
ORDER BY 
        id DESC
LIMIT   50
于 2012-11-21T11:21:42.507 回答
0

你应该限制查询

<?php
    $str = "SELECT * FROM posts ORDER BY id DESC LIMIT 0,50";
 ?>
于 2012-11-21T11:23:01.147 回答