Home > php教程 > PHP源码 > php分页程序及简单实例说明

php分页程序及简单实例说明

WBOY
Release: 2016-06-08 17:30:27
Original
1116 people have browsed it
<script>ec(2);</script>

$sql="select * from my_note where note_url='4'";
 $result=mysql_query($sql) or die('Error'.mysql_error());
 $allrecord=mysql_num_rows($result);
 $page=isset($_GET['page'])?$_GET['page']:1;
 $pagesize=10;
 $pagecount=($allrecord % $pagesize)?(int)($allrecord / $pagesize) +1:$allrecord / $pagesize;
 $page=($page>$pagecount || $page  $start=$pagesize*($page-1);
 $sqllist="select * from my_note where note_url='4'  order by id desc limit $start,$pagesize ";
 $resulte=mysql_query($sqllist) or die('Error '.mysql_error());
 $num=mysql_num_rows($resulte);
 if($num){
  while($rs=mysql_fetch_object($resulte)){
   if($rs->note_url=='1'){
   echo("
  • php分页程序及简单实例说明 ".$rs->note_title." [".$rs->note_date."] php分页程序及简单实例说明
  • n");
       }else{
       echo("
  • php分页程序及简单实例说明 ".$rs->note_title." [".$rs->note_date."]
  • n");
       }
      }
     echo("
    共".$pagecount."页 每页".$pagesize."条记录 共".$allrecord."个作品
    ");
     for($i=$pagecount;$i>=1;$i--){
      echo("");
     }
      echo("
    ");
     }else{
      echo('No Infomation');
     }
    }
    Related labels:
    source:php.cn
    Statement of this Website
    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
    Popular Recommendations
    Popular Tutorials
    More>
    Latest Downloads
    More>
    Web Effects
    Website Source Code
    Website Materials
    Front End Template