0

我知道我可能会再问一次,但我尝试了分页上可用的问题,但无法正确理解 dem ...需要知道对以下查询结果进行分页的方式:

$query = "SELECT * FROM info WHERE Cat1 = 'novel'";
$result = mysql_query($query);
if (!$result) die ("DAtabase acces faild bc : ". mysql_error());

echo " <ul class=listbkwide2>";

while($data = mysql_fetch_object($result))
{
$id = $data->id;
$name = $data->Bname ;
$continent = $data->Bauthor;

    echo "  <li class=bkd><a href='details.php?bid=$id'> 
         <img src='images/sbs/$name.jpg'  title='$name' alt=''>
      <ul class=showcasetitle> <span> $name </span> </ul>
       <p class=authname> By    <span> $continent</span></p>  
      ";
}
echo " </ul> ";
ini_set('display_errors', '1');
mysql_close();
4

1 回答 1

1

您需要维护偏移量,然后LIMIT在查询中添加一个子句。

[LIMIT {[offset,] row_count | row_count OFFSET offset}]

请参阅文档

于 2012-09-18T00:18:08.140 回答