Implementing a simple classification using the PHP page-out class

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.