标签:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>分页</title> </head> <body> <form action="0619aaa.php" method="get"> <div><input type="text" name="name" value=" "><input type="submit" value="查询"></div> </form> <table width="100%" cellspacing="0" cellpadding="0" border="1"> <tr> <td>代号</td> <td>区域名称</td> <td>父级代号</td> </tr> <?php include("0616DBDA.class.php"); $db=new DBDA(); include("Page.class.php"); $tj=" 1=1 "; $v=$_GET["name"]; if(!empty($v) && $v!="") { $tj=" AreaName like ‘%$v%‘"; } $ztj=" where {$tj}"; //球总条数 $szong="select count(*) from ChinaStates ".$ztj; $azong=$db->query($szong); $zongshu=$azong[0][0]; //造分页对象 $page=new Page($zongshu,15); //在SQL语句拼接分页条件 $sql="select * from ChinaStates ".$ztj.$page->limit; echo $sql; $attr=$db->query($sql); foreach($attr as $v) { echo" <tr> <td>{$v[0]}</td> <td>{$v[1]}</td> <td>{$v[3]}</td> </tr> "; } ?> </table> <div> <?php //返回分页信息 echo $page->fpage(); ?> </div> </body> </html>
标签:
原文地址:http://www.cnblogs.com/pangchunlei/p/5601829.html