How to implement paging interface in php
Editor to share with you how to achieve php paging interface, I believe that most people do not know much about it, so share this article for your reference, I hope you will learn a lot after reading this article, let's go to know it!
Php to achieve paging interface methods: 1, receive page values; 2, calculate the total number of entries; 3, calculate the offset; 4, through the "select * from table name limit ($offset, $page)" statement to query each page of data.
This article operating environment: windows7 system, PHP7.1 version, DELL G3 computer
It's very simple. We should master the train of thought.
Steps for php to write paging API:
1. Receive the value (the current number of pages $page, the number of entries per page $psize)
two。 Calculate the total number of entries
3. Calculate offset
$offset = (current pages-1) * number of entries per page displayed $offset = ($page-1) * $psize
4. Query each page of data
$data = select * from table name limit ($offset, $page)
The above is all the contents of the article "how to implement the paging interface in php". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!