After the php paging problem, please help paging the PHP MySQL database select
After pagination by php, the following html content is not displayed ..
The code is as follows:
// Page function
Require_once ("inc/dbconninfo. inc ");
$ Page = $ _ GET ["page"];
Function Page ($ rows, $ page_size ){
Global $ page, $ select_from, $ select_limit, $ pagenav;
$ Page_count = ceil ($ rows/$ page_size );
If ($ page <= 1 | $ page = '') $ page = 1;
If ($ page >=$ page_count) $ page = $ page_count;
$ Select_limit = $ page_size;
$ Select_from = ($ page-1) * $ page_size .',';
$ Pre_page = ($ page = 1 )? 1: $ page-1;
$ Next_page = ($ page = $ page_count )? $ Page_count: $ page + 1;
$ Pagenav. = "$ page/$ page_count page $ rows records ";
$ Pagenav. = "homepage ";
$ Pagenav. = "previous page ";
$ Pagenav. = "next page ";
$ Pagenav. = "Last page ";
$ Pagenav. = "Jump \ N ";For ($ I = 1; $ I <= $ page_count; $ I ++ ){If ($ I = $ page) $ pagenav. ="$ I\ N ";Else $ pagenav. ="$ I\ N ";}} // Page function// Example If (! $ Conn = mysql_connect ("localhost", "admin", "") die ('database selection failed! ');If (! Mysql_select_db ("test", $ conn) die ('database selection failed! ');Mysql_query ('set names gbk '); // Use the Page function to calculate the records from which $ select_from is retrieved and the pagenav output paging navigation.$ Rows = mysql_num_rows (mysql_query ("select * from product "));Page ($ rows, 8 ); $ SQL = "select * from product limit $ select_from $ select_limit ";$ Rst = mysql_query ($ SQL );While ($ row = mysql_fetch_array ($ rst )){Echo "$ row [id]-$ row [name]";} This is the line. with this line, nothing is shown below ..Echo $ pagenav ;!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!! ?> Links Reply to discussion (solution)...For ($ I = 1; $ I <= $ page_count; $ I ++ ){If ($ I = $ page) $ pagenav. ="$ I\ N ";Else $ pagenav. ="$ I\ N ";}$ Pagenav. ="";
} // Page function
The statement in red is missing.
When the select mark is not completed, the code is used as a select member.
Thank you very much, thank you very much... The problem is solved ..
It seems that I am so careless ....