Home > Backend Development > PHP Tutorial > 各位老师,帮小弟我看看能不能改成支持可分页

各位老师,帮小弟我看看能不能改成支持可分页

WBOY
Release: 2016-06-13 13:13:35
Original
785 people have browsed it

各位老师,帮我看看能不能改成支持可分页。
include("Conn/conn.php");
$query=mysql_query("select book.barcode,book.id as bookid,book.bookname,bt.typename,pb.pubname,bc.name from tb_bookinfo book join tb_booktype bt on book.typeid=bt.id join tb_publishing pb on book.ISBN=pb.ISBN join tb_bookcase bc on book.bookcase=bc.id");
$result=mysql_fetch_array($query);
  if($result==false){
?> 
 


 
 
 
 
暂无图书信息!

 
 
 
 

  添加图书信息

 }else{
?>
 
 
 
 
 
 
  添加图书信息
 
 
 
   
 
 
 
 
 
 
 

 
   
 
   
   
   
 
 
 

  }while($result=mysql_fetch_array($query));
}
?>  
条形码图书名称 图书类型 出版社 书架 修改 删除
        修改 删除


------解决方案--------------------
可以改,改的代码有点多,从头改到尾,理清头绪难度不大
1:分页标识与两个参数卡定 url?startPostion=0&number=10
startPostion开始位置,number一次条数
2:查询条件
$sqlString="select * from myTable1 where 1 limit $startPos,$num";
//明白这句话就实现了一半
3:底下生成页数前一页与后一页与对应的链接
明白后都是体力活了

我表达清楚了没?



------解决方案--------------------
分页其实弄清楚
1、当前第几页
2、每页显示数
就可以了

通过上面2个条件,写sql语句。
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 Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template