Home >Backend Development >PHP Tutorial >Discussion on PHP paging principle, an example of PHP paging code
The first sentence is to find 5 from zero The second piece of information is to search for 5 pieces of information starting from 5. Needless to say the third piece of information. First of all, 0=(1-1)*5, 5=(2-1)*5, 10=(3-1)*5. Here you need to understand what 1, 2, 3 represent, and what 5 represents. Whatever it is is fine. 1, 2, and 3 represent the current page, that is, the first, second, and third pages; 5 is the number of records displayed. Get the query formula:
How to get the $page value. Use $_GET(page) to obtain it here. Specific steps: First, determine the number of output records $pagesize=5; Use $url=$_srever["request_uri"]; To get the current url; then parse the url through parse_url(), and finally get the path value. This is the url required in paging. php paging code: [code] include "conn.php"; include "head.php"; ?> |