This article is mainly to share with you PHP and MySQL implementation data paging display instances, I hope to help everyone.
Get the number of records in the result set you can use the count () function in a SELECT statement to get the number of records in the result set
Set the number of display records per page assume that a variable is used $PageSize to hold the number of displayed records per page, and that its value is set by the user as needed, and can be implemented directly through an assignment statement.
Get the total number of pages can be $RecordCount $PageSize calculated with two data to get the total number of pages $PageCount ,
How to display records on page n although using the PageSize property, you can control the number of records displayed per page, but what are the records displayed? You can use the limit clause in a SELECT statement to specify the scope of the query record, using the following method: SELECT * from table name limit start position, display number of records for example, to get the $Page records on page, you can use the following statement:SELECT * FROM 表名LIMIT ($Page- 1) * $ PageSize, $ PageSize
How to tell the script which page number to display can tell the script to display the page number by passing the parameter. Assume that the script that is marked for paging is viewpage. PHP, the link to pass parameters is as follows: The http:// localhost/ viewPage. php? page= 2 parameter page is used to specify the current page number. In ViewPage. In PHP, use the following statement to read the parameters:
<!doctype html>
Get the number of records in the result set you can use the count () function in a SELECT statement to get the number of records in the result set
Set the number of display records per page assume that a variable is used $PageSize to hold the number of displayed records per page, and that its value is set by the user as needed, and can be implemented directly through an assignment statement.
Get the total number of pages can be $RecordCount $PageSize calculated with two data to get the total number of pages $PageCount ,
How to display records on page n although using the PageSize property, you can control the number of records displayed per page, but what are the records displayed? You can use the limit clause in a SELECT statement to specify the scope of the query record, using the following method: SELECT * from table name limit start position, display number of records for example, to get the $Page records on page, you can use the following statement:SELECT * FROM 表名LIMIT ($Page- 1) * $ PageSize, $ PageSize
How to tell the script which page number to display can tell the script to display the page number by passing the parameter. Assume that the script that is marked for paging is viewpage. PHP, the link to pass parameters is as follows: The http:// localhost/ viewPage. php? page= 2 parameter page is used to specify the current page number. In ViewPage. In PHP, use the following statement to read the parameters:
<!doctype html>