本帖最后由 miehunyou 于 2011-05-20 15:18:06 编辑

解决方案 »

  1.   

    $sql="select * from book";
    $arr=$db->execute($sql);
    $rows=count($arr);
    if($rows%5==0){
    $pages=$rows/5;
    }else{
    $pages=(int)($pages/5)+1;
    }
    @$currentPage=$_GET['currentPage'];
    if(!isset($currentPage) || $currentPage<1){
    $currentPage=1;
    }
    if($currentPage>$pages && $pages!=0){
    $currentPage=$pages;
    }
    $sql="select * from book limit ".(($currentPage-1)*5).",5";
    $arr=$db->execute($sql);看看这个 可以帮助你不,
      

  2.   

    我不太会用呢...我才学php一个礼拜...
    这些让我其他资料都不见了,剩下个table...
      

  3.   

    <?php
     $con = mysql_connect("localhost","root","");
     if (!$con)
       {
       die('Could not connect: ' . mysql_error()."<br>");
       }
    mysql_select_db("bg_db", $con);
    $result = mysql_query("SELECT * FROM Persons ORDER BY GuestId desc limit 5",$con);echo "<table border='1'>
    <tr>
    <th>No.</th>
    <th width='98%'>Guest</th>
    </tr>";while($row = mysql_fetch_array($result))
      {
      echo "<tr>";
      echo "<td>" . ++$no . ".</td>";
      echo "<td>Name : " . $row['Name'] . 
           "<br>Email : " . $row['Email'] . 
           "<br>Country : " . $row['Country'] . 
           "<br><br>" . $row['Comment'] . "</td>";
      echo "</tr>";
      }
    echo "</table>";
    ?>
    我暂时把一面限制成五项了,要怎么翻页= =