php中的实用分页类

时间:2024-01-14 10:09:02
<table width="100%" border="1" cellpadding="0" cellspacing="0">
<tr>
<td>地区代号</td>
<td>地区名称</td>
<td>父级代号</td>
</tr> <?php
include("LZY.class.php");
$db = new LZY();
include("page.class.php"); //查总条数
$sz = "select count(*) from chinastates";
$az = $db->Query($sz); //1.造对象
$page = new Page($az[0][0],10); //2.将分页类的limit变量拼接在SQL语句后面
$sql = "select * from chinastates ".$page->limit; $arr = $db->Query($sql); foreach($arr as $v)
{
echo "<tr>
<td>{$v[0]}</td>
<td>{$v[1]}</td>
<td>{$v[2]}</td>
</tr>";
}
?> </table> <?php //3.输出分页信息
echo $page->fpage(); ?> </body>

php中的实用分页类