- Select * from book limit 0, 5;
- Select * from book limit 5, 5;
- Select * from book limit 10, 5;
The first statement is to search for five pieces of information from scratch, and the second statement is to search for five pieces of information from 5. The third statement is unnecessary. First, 0 = (1-1) * 5, 5 = (2-1) * 5, 10 = (3-1) * 5. here we need to understand 1, 2, 3 represents what, and 5 represents what. 1, 2, 3 indicates the current page, that is, the first, second, and third pages; 5 indicates the number of records displayed. Obtain the query formula:
- Select * from book limit ($ pageval-1) * $ pagesize, $ pagesize;
How to obtain the $ page value. Here, we use $ _ GET (page) to obtain it. Specific steps: First, determine the number of output records $ pagesize = 5; use $ url = $ _ srever ["request_uri"]; to obtain the current url, and then use parse_url () parse the url and obtain the path value. This is the url in the page. Php paging code: [Code]
|