Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What is the simple and practical native PHP paging class?

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

This article shows you what the simple and practical native PHP paging class is like, the content is concise and easy to understand, can definitely brighten your eyes, through the detailed introduction of this article, I hope you can get something.

A simple and practical native PHP paging class, the paging button style is simple and beautiful, and displays "..." when there are many pages, which is also the effect used by many websites.

Core paging code

Include_once ("config.php"); require_once ('page.class.php'); / / paging class $showrow = 10; / / number of rows displayed on a page $curpage = empty ($_ GET [' page'])? 1: $_ GET ['page']; / / the current page should also handle non-numeric cases $url = "? page= {page}" / / paging address, if there is a search condition = "? page= {page} & Q =". $_ GET ['q'] / / omits the code for linking mysql, add $sql = "SELECT id,content,addtime FROM wishing_wall" during the test; $total = mysql_num_rows (mysql_query ($sql)) / / the total number of records if (! empty ($_ GET ['page']) & $total! = 0 & & $curpage > ceil ($total / $showrow)) $curpage = ceil ($total_rows / $showrow); / / the current number of pages is greater than the last number of pages, take the last page / / get the data $sql. = "LIMIT". ($curpage-1) * $showrow. ", $showrow;"; $query = mysql_query ($sql)

Paged list data display

Show paging button

The above is what the simple and practical native PHP paging class looks like. Have you learned any knowledge or skills? If you want to learn more skills or enrich your knowledge reserve, you are welcome to follow the industry information channel.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report