Simple paging is a simple and easy-to-use paging class. You only need to add or modify one sentence in your original program, and then paste the code paging. phpPHPcode & lt ;? PhpclassPaging {publicstatic $ count0; publicstatic $ size0; publicstatic $ page0; staticfunctio simple paging class
This is a simple and easy-to-use paging class. You only need to add or modify one sentence in your original program.
Post code first
Paging. php
PHP code
1, 'prve' => $ page> 1? $ Page-1: 1, 'next' => $ page <$ count? $ Page + 1: $ count, 'end' => $ count,); foreach ($ d as $ k => $ v) {$ _ GET ['Page'] = $ v; $ tpl = str_replace ($ k, http_build_query ($ _ GET), $ tpl);} echo $ tpl ;}}
You usually have statements like this.
$ SQL = ".....";
$ Rs = mysql_query ($ SQL );
Or
$ Rs = mysql_query ("select ....");
You only need to change
Include 'Paging. php ';
$ Rs = paging: prepare ($ SQL, number of lines per page );
Write to the place where paging entries need to appear
Paging: bar ();
It's easy!
------ Solution --------------------
Front-row worship mode.
This is the first time I have seen it.
$ SQL = preg_replace ('/select \ s/I', '$ 0SQL_CALC_FOUND_ROWS', $ SQL). "limit $ pageon, $ pagesize ";
SQL also uses preg_replace ......
------ Solution --------------------
Thanks for sharing. it is really convenient and easy to use. I learned.
------ Solution --------------------
Discussion
This is a simple and easy-to-use paging class. You only need to add or modify one sentence in your original program.
Post code first
Paging. php
PHP code
Class Paging {
Public static $ count = 0;
Public static $ size = 0;
Public static $ page = 0;
Static function prepare ($ SQL, $ ......