Home > Database > Mysql Tutorial > body text

MySQL分页实现_MySQL

WBOY
Release: 2016-06-01 13:14:43
Original
852 people have browsed it

mysql> select pname from product;

+--------+| pname  |+--------+| 产品1  || 产品2  || 产品三 |+--------+

3 rows in set (0.00 sec)

这个地方是说,从product中选出所有的pname来,一共有三条记录。

MySQL中的分页非常简单,我们可以使用limit

比如:

mysql> select pname from product limit 0,2;

+-------+| pname |+-------+| 产品1 || 产品2 |+-------+

2 rows in set (0.00 sec)

Limit用法如下:

第一个参数是指要开始的地方,第二个参数是指每页显示多少条数据;注意:第一页用0表示。


Mysql分页:

         select * from tableName where 条件 limit 当前页码*页面容量-1 , 页面容量
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