PHP实现分页的一个示例_PHP教程
程序员文章站
2022-03-25 08:30:21
...
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);
?>
$pad=0;
for($counter=1;$counter{
if($counter>=10)
{
$pad="";
}
echo("".$pad.$counter." ");
}
?>
{
$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);
?>
编号 | 用户名 | 发表人 | 文章标题 | 发表时间 |
" target="disp"> |
$pad=0;
for($counter=1;$counter{
if($counter>=10)
{
$pad="";
}
echo("".$pad.$counter." ");
}
?>