下面我们来看看我自己写的一个简单的php分页代码哦,其实在php中分页比较在asp中分页容易的多,这也可能是因为mysql有强大的功能的吧,这样节省不少系统资源了
function newlista($action){
$sql ="Select * from gx_news ";
if( $action=='today' ){ $sql.=" where datediff(new_time,".date("Y-m-d").")
$result =mysql_query($sql) or die('fail1'.mysql_error());
$rs =mysql_fetch_array($result);
$rdcount =mysql_num_rows($result);
if($rdcount){
$pagesize =15;
$pagecount=($rdcount % $pagesize)?(int)($rdcount / $pagesize)+1:$rdcount/$pagesize;//统计总页面
$page =isset($_GET['page'])?$_GET['page']:1;//取得当前页面
$start =($page>=1 && $page
$start =$start;
$sql =$sql." order by id desc limit $start,$pagesize";
$bg =1;
//$resulte =mysql_query($sql) or die('fail'.mysql_error());
$result =mysql_query($sql) or die(mysql_error());
while($rs =mysql_fetch_array($result) ){
if( $bg % 2 !=0){
$style="class=color";
}else{
$;
}
echo "
$bg++;
}
echo ' ";
}else{
echo '暂时没有信息!';
}
}
本人原创转载注明www.111cn.net/phper/php.html

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

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

DVWA
Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software

VSCode Windows 64-bit Download
A free and powerful IDE editor launched by Microsoft

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

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

Dreamweaver Mac version
Visual web development tools