Pagination class Address: http://blog.csdn.net/buyingfei8888/article/details/40260127
Just Soso.
The implementation of paging is divided into 4 main steps:
1 Introducing page-Paging classes
2 Instantiating a paging class
3 assembling it into an SQL statement
4 Print out the pagination effect
Code:
<?php//database Connection $link = mysql_connect (' 127.0.0.1 ', ' root ', '); mysql_select_db (' php0507 ', $link);//sets the character set mysql_query (' Set names UTF8 '); Get the total number of records $sql _1 = mysql_query (' Select COUNT (*) as Count from Sw_goods '); Returns a resource-type variable $rzt _1 = Mysql_fetch_assoc ($sql _1); $cnt = $rzt _1[' count '];//while ($rzt _1 = Mysql_fetch_assoc ($sql _1)) {// echo $rzt _1[' count '];//} $per = 6;//display of records per page R Equire_once (' page.class.php '); $page = New Page ($cnt, $per); Obtain the information $sql _2 = mysql_query ("select * from Sw_goods $page->limit"); while ($rzt _2 = Mysql_fetch_assoc ($sql _2)) { echo $rzt _2[' goods_id ']. ' -----'. $rzt _2[' Goods_name '). ' <br/> '; } echo $page->fpage ();? >
Implementing a simple classification using the PHP page-out class