1. Limit usage in SQL statements
SELECT * FROM table ... limit start position, number of operation bars (start position starting from 0)
SELECT * FROM Table ... limit 0, 20 (take front 20)
SELECT * FROM Table ... limit 10, 20 (starting from 11 fetch 20)
2. A formula for learning pagination
(1) Paging principle
The so-called paging display, that is, the result set in the database, a section of the display
(2) Required conditions
How to segment, current in the first paragraph (there are several pages per page, the current second page)
Top 10 Records: SELECT * FROM table limit 0,10
11th to 20th record: SELECT * FROM table limit 10,10
21st to 30th Record: SELECT * FROM table limit 20,10
(3) Get the formula
(Current page-1) x number of pages per page, number of articles per page
Select * FROM table limit ($Page-1) * $PageSize, $PageSize
3. Parse_url () Parse URL function
Parse_url () is a function that parses a URL into an array with fixed key values.
$ua =parse_url ("Http://username:[email protected]/path?arg=value#anchor");p Rint_r ($ua); Result: Array ([scheme] = HTTP [Host] = hostname [user] = username [pass] = password [path] +/path [query] = arg =value [Fragment] = anchor)
4.$_server["Request_url"] function
One of the predefined server variables, all at the beginning of the $_server, called Predefined server variables
Request_url is the function to get the current URL, but also the full address path in addition to the domain name
The current page is: http://www.php.com/home.php?id=23&cid=22
echo $_server["Request_url"]
Results:/home.php?id=23&cid=22