码迷,mamicode.com
首页 > Web开发 > 详细

php中的实用分页类

时间:2017-02-26 20:54:55      阅读:245      评论:0      收藏:0      [点我收藏+]

标签:sel   pre   from   cell   include   table   lsp   ble   pad   

<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中的实用分页类

标签:sel   pre   from   cell   include   table   lsp   ble   pad   

原文地址:http://www.cnblogs.com/li1056822533/p/6445613.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!