// Enter the query statement, database name, database connection, current page number, link string, and number of items in the list. the functiongetpagenav ($ SQL, $ dbname, $ db, $ page, $ link, $ pagelistnum) {/////////////////////////////////////// ////
// Enter the query statement, database name, database connection, current page number, link string, and number of list entries. the high/low navigation links are displayed.
Function getpagenav ($ SQL, $ dbname, $ db, $ page, $ link, $ pagelistnum)
{
//////////////////////////////////////// /////////////////////////////////////
/* General PHP paging function */
/* Author: twt326 () 2004.3.26 */
/* EMAIL: twt326@163.com QQ: 195314193 */
/* Efficacy: Enter the SQL query statements, database names, database connections, and current page number that can obtain all records */
/* And the parameters included in the original webpage (to prevent damage to the original webpage parameters), the number of entries displayed per page */
/* Example: echo getpagenav ($ SQL, 'DB _ ABC', $ dbconn, 8, 'list. php? Act = list & p = up ', 10 )*/
/* Results: number of records on the last page of the first page on the previous page on the last page on the previous page: X */
/* Welcome to comments !! Long live open source !! */
//////////////////////////////////////// /////////////////////////////////////
$ Result = @ mysql_db_query ($ dbname, $ SQL, $ db );
$ Sumrows = @ mysql_num_rows ($ result); // The total number of rows.
If (empty ($ page ))
$ Nowpage = 1;
Else
$ Nowpage = $ page; // current page
$ Sumpage = floor ($ sumrows/$ pagelistnum) 1; // total number of pages
If ($ sumrows % $ pagelistnum = 0) $ sumpage = $ sumrows/$ pagelistnum;
$ Tmphead = 'If ($ nowpage <2)
$ Showdown = 'previous page 1 ';
Else
$ Showdown = $ tmphead. '1> first page '. $ tmphead. ($ nowpage-1).'> Previous Page ';
If ($ nowpage <$ sumpage)
$ Showdown = $ showdown. $ tmphead. ($ nowpage 1). '> Next Page'. $ tmphead. $ sumpage. '> last page ';
Else
$ Showdown = $ showdown. 'next page last page ';
$ Showdown. = 'name'. $ nowpage. 'page, in total'. $ sumpage. 'page number of records per page: $ pagelistnum total number of records: $ sumrows ';