首頁  >  文章  >  php教程  >  PHP实现分页的一个示例

PHP实现分页的一个示例

WBOY
WBOY原創
2016-06-13 12:42:11871瀏覽

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);
?>




    
      
      
      
      
      
   
while(($bbsrow=mysql_fetch_array($bbsresult)) && ($noterecs{

?>

      
      
      
      
      


$noterecs=$noterecs+1;
}
?>
编号 用户名 发表人 文章标题 发表时间
" target="disp">








$pad=0;
for($counter=1;$counter{
if($counter>=10)
{  
$pad="";
}

echo("".$pad.$counter."  ");
}
?> 
陳述:
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn