For php paging problems, please help

Source: Internet
Author: User
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 ....

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.