Home  >  Article  >  Backend Development  >  请问关于PHP中关联多表相关字段,并做分页处理的SQL语句写法

请问关于PHP中关联多表相关字段,并做分页处理的SQL语句写法

WBOY
WBOYOriginal
2016-06-13 13:12:50755browse

请教关于PHP中关联多表相关字段,并做分页处理的SQL语句写法
我有四个表,分别是tb_bookinfo。tb_booktype。tb_bookcase。tb_publishing。在这几个表中有相互关联的字段,下面是我没有加分页的SQL语句,在do....while()中输出正常。问题是数据越来越大,现在想添加分页功能。代码一直未能改成功,请各位PHP达人帮我看看(不要网上复制过来的分页代码,请根据我的这个SQL语句,改动一下,让我能够实现分页)附分页要求“共N条记录,每页显示N条,当前第N页,第一页,上一页,下一页,尾页”。小弟在此先谢过了。
$query=mysql_query("select b.*,c.name as bookcasename,p.pubname,t.typename from tb_bookinfo b left join tb_bookcase c on b.bookcase=c.id join tb_publishing p on b.ISBN=p.ISBN join tb_booktype t on b.typeid=t.id");

------解决方案--------------------
加上 limit 参数不就可以实现分页了

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