The source of
<style type="text/css"> div.pagination { padding: 3px; margin: 4px; } div.pagination a { padding: 2px 5px 2px 5px; margin: 4px; border: 1px solid #666; text-decoration: none; /* no underline */ color: #666; } div.pagination a:hover, div.pagination a:active { border: 1px solid #333; color: #000; } div.pagination span.current { padding: 2px 5px 2px 5px; margin: 4px; border: 1px solid #333; font-weight: bold; background-color: #666; color: #FFF; } div.pagination span.disabled { padding: 2px 5px 2px 5px; margin: 4px; border: 1px solid #EEE; color: #DDD; } </style>
<?php $c $tbl_name="main";<span style="white-space:pre"> //查询的表格 $limit=5;<span style="white-space:pre"> </span>//每页条数 $adjacents = 3; //当前页的左n页,右n页 $query = "SELECT COUNT(*) FROM $tbl_name"; $total_pages = mysqli_fetch_array(mysqli_query($conn,$query)); $total_pages = $total_pages[0]; $targetpage = "main2.php"; @$page = $_GET['page']; if($page) $start = ($page - 1) * $limit; else $start = 0; $sql = "select * from `".$tbl_name."` limit ".$start.",".$limit;//主查询语句 $result1 = mysqli_query($conn,$sql); if ($page == 0) $page = 1; $prev = $page - 1; $next = $page + 1; $lastpage = ceil($total_pages/$limit); $lpm1 = $lastpage - 1; $pagination = ""; if($lastpage > 1) { $pagination .= "<div class='\"pagination\"' align='\"center\"'>"; if ($page > 1) $pagination.= "<a href="%5C%22%24targetpage?page=%24prev%5C%22">前一页</a>"; else $pagination.= "<span class='\"disabled\"'>前一页</span>"; if ($lastpage $counter"; else $pagination.= "<a href="%5C%22%24targetpage?page=%24counter%5C%22">$counter</a>"; } } elseif($lastpage > 5 + ($adjacents * 2)) { if($page $counter"; else $pagination.= "<a href="%5C%22%24targetpage?page=%24counter%5C%22">$counter</a>"; } $pagination.= "..."; $pagination.= "<a href="%5C%22%24targetpage?page=%24lpm1%5C%22">$lpm1</a>"; $pagination.= "<a href="%5C%22%24targetpage?page=%24lastpage%5C%22">$lastpage</a>"; } elseif($lastpage - ($adjacents * 2) > $page && $page > ($adjacents * 2)) { $pagination.= "<a href="%5C%22%24targetpage?page=1%5C%22">1</a>"; $pagination.= "<a href="%5C%22%24targetpage?page=2%5C%22">2</a>"; $pagination.= "..."; for ($counter = $page - $adjacents; $counter $counter"; else $pagination.= "<a href="%5C%22%24targetpage?page=%24counter%5C%22">$counter</a>"; } $pagination.= "..."; $pagination.= "<a href="%5C%22%24targetpage?page=%24lpm1%5C%22">$lpm1</a>"; $pagination.= "<a href="%5C%22%24targetpage?page=%24lastpage%5C%22">$lastpage</a>"; } else { $pagination.= "<a href="%5C%22%24targetpage?page=1%5C%22">1</a>"; $pagination.= "<a href="%5C%22%24targetpage?page=2%5C%22">2</a>"; $pagination.= "..."; for ($counter = $lastpage - (2 + ($adjacents * 2)); $counter $counter"; else $pagination.= "<a href="%5C%22%24targetpage?page=%24counter%5C%22">$counter</a>"; } } } if ($page 下一页"; else $pagination.= "<span class='\"disabled\"'>下一页</span>"; $pagination.= "</div>\n"; } ?> //此处放主表格 =$pagination?>//显示页码is no longer available...
The above introduces the simplest PHP paging, including the relevant content. I hope it will be helpful to friends who are interested in PHP tutorials.

php提交表单通过后,弹出的对话框怎样在当前页弹出php提交表单通过后,弹出的对话框怎样在当前页弹出而不是在空白页弹出?想实现这样的效果:而不是空白页弹出:------解决方案--------------------如果你的验证用PHP在后端,那么就用Ajax;仅供参考:HTML code<form name="myform"

Vue项目中实现数据的分页和显示优化在Vue项目中,当页面需要展示大量数据时,通常需要进行数据的分页和显示优化以提高用户体验,本文将介绍如何使用Vue实现数据的分页和显示优化,并提供具体的代码示例。一、数据分页数据分页是指将大量数据按照一定的规则分割成多页,并在页面上进行分页显示。Vue项目中可以使用如下步骤来实现数据分页:定义数据源首先,定义一个包含所有数

每个人都在期待今天的Windows1123H2发布。事实上,Microsoft刚刚启动了对发布预览版的更新,这是正式发布阶段之前最接近的频道。被称为Build22631的Microsoft表示,他们正在推出新的更名聊天应用程序,电话链接和一起玩小部件,这些小部件在过去几个月中已在其他内部渠道中进行了测试。“这个新的更新将具有与Windows11版本22H2相同的服务分支和代码库,并将与所有新宣布的功能累积,包括Windows中的Copilot(预览版),”Microsoft承诺。雷德蒙德官员进一

描述项目描述Python解释器3.10.6Counter模块在Python的collections模块中,有一个很常用的模块就是Counter。Counter是一个简单的计数器,用于统计某些可哈希对象的数量。它以字典的形式存储元素和它们的计数。Counter()类类Counter()能够对传入给该类的参数按照一定规则进行计数,并将计数对象与计数结果作为键值对以字典的形式进行结果的返回。Counter(iterable=None,/,**kwds)举个栗子fromcollectionsimport

CSS序号属性详解:counter和list-style-type引言:在网页设计中,常常会遇到需要为列表或标题等元素编号的情况。为了满足不同的设计需求,CSS提供了两个重要的属性:counter和list-style-type。本文将详细介绍这两个属性的用法,并提供一些具体的代码示例。一、counter属性:counter属性允许开发者创建

CSS内容属性详解:content、counter和quotesCSS(层叠样式表)是前端开发中不可或缺的一部分,它可以帮助我们美化网页并增强用户体验。在CSS中,有一些特殊的属性可以用于控制文本内容的显示,其中包括content、counter和quotes。本文将详细介绍这些属性,并提供具体的代码示例。一、content属性content属性

Laravel开发:如何使用LaravelPagination分页数据?Laravel是一个强大的PHP框架,可以帮助开发人员快速构建高质量的Web应用程序。在Laravel应用程序中,经常需要将数据分页显示。Laravel提供了一个强大的分页器类——LaravelPagination,使数据分页变得非常容易。在本文中,我将向您展示如何使用Laravel

不用数据库来实现用户的简单的下载,代码如下,但是却不能下载,请高手找下原因,文件路劲什么的没问题。<?phpfunction down_file($file_name,$file_sub_dir){//为防止乱码使用函数iconv$file_name=iconv("utf-8","gb2312",$file_


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

SAP NetWeaver Server Adapter for Eclipse
Integrate Eclipse with SAP NetWeaver application server.

SublimeText3 Linux new version
SublimeText3 Linux latest version

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Zend Studio 13.0.1
Powerful PHP integrated development environment

SublimeText3 Chinese version
Chinese version, very easy to use
