This article mainly introduces the simple implementation code of php paging query, which has some reference value, interested friends can refer to this article for details about the simple implementation code of php paging query, which has some reference value. interested friends can refer
I have learned a lot about php recently. the teacher told us that all I have learned is the core part of php, so I paid more attention to it and practiced it several times, relatively speaking, it is easy to understand. it is not as difficult as it was when you first started learning. to sum up, it is a feeling. mentality is the most important. it is a mentality problem at the beginning, considering all aspects of the problem, I can't calm down, and I haven't been able to sit down and study for many years. I always feel that I can't sit still. after a period of time, I have to rest, including a period of time at home during the Chinese New Year, after returning to the system again, my mind has changed a lot and I feel that my learning is not so boring. Instead, I feel like many years ago, when I encountered a mathematical problem, I especially want to overcome it.
There are a lot of complaints, haha. This morning, I mainly studied paging query: if there is a large amount of data, the page will look a lot, and it will look very tired. at this time, we will use paging, I have already written a paging query, and it looks clear. today I learned the paging query, which is relatively simple. I added a query condition on the basis of the paging, the chinastates table is used this time:
The first three columns are used, namely the region code, region name, and parent code. The get element is used for paging query, when querying by page, the title bar is displayed.
If post is used to obtain the information, it will be troublesome. in this case, you need to modify the new page, write the third condition in the brackets, and add comments to the code identifiers, the results are also displayed in the uploaded image. the query result is "medium" and the second page is displayed.
Paging query
| Region code |
Region name |
Parent code |
Query ($ sqg); $ page = new page ($ arg [0] [0], 20 ); // If post is used, you can change it to new page (, "areaname = '{$ area }'") $ SQL = "select * from chinastates where {$ tj }". $ page-> limit; $ arr = $ db-> Query ($ SQL); foreach ($ arr as $ v) {echo"
| {$ V [0]} |
{$ V [1]} |
{$ V [2]} |
";}?>
Fpage ();?>
The above is a simple example of code sharing (figure) for php paging query. For more information, see other related articles in the first PHP community!