- php教程首页
- php分页
php 带条件查询 分页代码
•php分页•阅读 268 - if(!isset($_get[absolutepage])){
- $absolutepage=1;//当前页//开源代码phpfensi.com
- }
- if ($_get[absolutepage]==0){
- $absolutepage=1;
- }else {
- $absolutepage=$_get[absolutepage];
- $absolutepage=intval($absolutepage);
- }
- $pagesize=5;//一页现实的数量
- $a= (($absolutepage - 1) * $pagesize);
- $sql1=$sql." limit $a,$pagesize ";
- $nums=mysql_num_rows($query);//总数
- $pagecount = (int)(($nums - 1) / $pagesize) + 1;//总页数
- if ($absolutepage>1 && $nums>1){
- $prevpage=$absolutepage-1;
- }
- if ($absolutepage>=1 && $absolutepage<$pagecount){
- $nextpage=$absolutepage+1;
- }
- if ($absolutepage > $pagecount) {
- $absolutepage = $pagecount;
- }
- $prevpage="<a href='".(strpos($_server['request_uri'],'?') ? "{$_server['request_uri']}&" : '?')."absolutepage=$prevpage'>上一页</a>";
- $nextpage="<a href='".(strpos($_server['request_uri'],'?') ? "{$_server['request_uri']}&" : '?')."absolutepage=$nextpage'>下一页</a>";