瑞鲁手机APP下载网_专注推荐好用的手机APP和游戏APP

PHP实现分页的一个示例

PHP实现分页的一个示例

查看人次:1摘自:手机APP下载网

<?php if(!$whichpage) {    $notepage=1; } else {  $notepage=$whichpage; } $noterecs=0; $pagesize=10; $bbsconn=mysql_connect("localhost","root"); mysql_select_db("rainwindy",$bbsconn); $bbsresult=mysql_query("select * from bbs order by id desc",$bbsconn); $rsnum=mysql_num_rows($bbsresult); $pagecount=ceil($rsnum/$pagesize); mysql_data_seek($bbsresult,($notepage-1)*10); ?>

                                            <?php while(($bbsrow=mysql_fetch_array($bbsresult)) && ($noterecs<=9)) { ?>                                              <?php $noterecs=$noterecs+1; } ?>

<?php $pad=0; for($counter=1;$counter<=$pagecount;$counter++) {  if($counter>=10) {    $pad=""; } echo("".$pad.$counter."&nbsp;&nbsp;"); } ?> 

相关文摘:PHP技巧 windows
标题名称:《PHP实现分页的一个示例》
本文网址:https://www.sdruilu.cn/news/tpart-28487.html