Home > Database > Mysql Tutorial > body text

基础分页 php+mysql_MySQL

WBOY
Release: 2016-06-01 13:10:16
Original
848 people have browsed it

读取表中的数据,并且分页

//分页算法
$pagesize = 10; //读取10条数据
$pagenum = $GET['page'] ? $GET['page'] : 1; //检索当前在第几页
$offset = ($pagenume - 1) * $pagesize;

$sql = “SELECT * FROM income order by id {$offset},{$pagesize} “;

//获取上下页
$nextpage = $pagenum + 1;
$prevpage = $pagenum - 1;

输出

上一页 | 下一页

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