Home  >  Article  >  Backend Development  >  php pagination 1_PHP tutorial

php pagination 1_PHP tutorial

WBOY
WBOYOriginal
2016-07-13 17:49:171055browse

/**
* 用户列表
* kcj
* 2011/8/20
* */
include "../conn/conn.php";
$sql="select * from user";
$rst=mysql_query($sql);
$totalnum=mysql_num_rows($rst);
$pagesize=2;
$page=$_GET['page'];
if($page==''){
$page=1;
}
$pagecount=ceil($totalnum/$pagesize);
$bingage=($page-1)*$pagesize;
?> 
 
 
 
无标题文档 
 
 
 
 
 
 

 
  后台管理->用户列表 
  
 
 
     
  •  
    用户名 
    备注名 
    注册时间 
    操  作 
  •  
          
  •  
      $sql="select * from user order by id asc limit $bingage,$pagesize";
    $rst=mysql_query($sql);
    while ($row=mysql_fetch_array($rst)){
    ?> 
     
     
     
     
     
     
       
    修改】 
     
    删除】 
     
     
    }
    ?> 
  •  
     
     
  •  
      
      共条;  共页;  每页显示条 
    首页 
      for ($i=1;$i<=$pagecount;$i++){
    echo "【".$i."】"; 
      } 
       
     ?> 
    尾页 
     
  •  
  
 
                   
 
 
 
 

摘自 chaojie2009的专栏

www.bkjia.comtruehttp://www.bkjia.com/PHPjc/478356.htmlTechArticle?php /*** User list * kcj * 2011/8/20 **/ include ../conn/conn.php; $sql=select * from user; $rst=mysql_query($sql); $totalnum=mysql_num_rows($rst); $pagesize=2; $page=$_GET[pa...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn