demo

<?php
header("Content-Type:text/html;charset=utf-8");
include "page.class.php";

$link=mysql_connect("localhost", "root", "");

mysql_select_db("bbs");


$result=mysql_query("select * from content");


$total=mysql_num_rows($result);

$num=5;

$page=new Page($total, $num, "&cid=99");

$sql="select * from content {$page->limit}";

$result=mysql_query($sql);

echo '<table align="center" border="1" width="960">';
echo '<caption><h1>SHOPS</h1></caption>';

while($row=mysql_fetch_assoc($result)){
echo '<tr>';
echo '<td>'.$row["id"].'</td>';
echo '<td>'.$row["user"].'</td>';
echo '<td>'.$row["content"].'</td>';
echo '<td>'.$row["title"].'</td>';

echo '</tr>';
}

echo '<tr><td colspan="5" align="right">'.$page->fpage(array(8,3,4,5,6,7,0,1,2)).'</td></tr>';
echo '</table>';
原文地址:https://www.cnblogs.com/panmyth/p/2388439.html