php试用smarty和ADODB实现对数据分页读取(3)
来源:未知 责任编辑:责任编辑 发表时间:2014-04-20 03:36 点击:次
}
}
}
class SepPage{
var $rs;
var $pagesize;
var $nowpage;
var $array;
var $conn;
var $sqlstr;
function ShowData($sqlstr,$conn,$pagesize,$nowpage){
if(!isset($nowpage)||$nowpage==""){
$this->nowpage = 1;
}else{
$this->nowpage = $nowpage;
}
$this->pagesize = $pagesize;
$this->conn = $conn;
$this->sqlstr = $sqlstr;
//执行查询语句
$this->rs = $this->conn->PageExecute($this->sqlstr,$this->pagesize,$this->nowpage);//调用ADODO类中的这个方法
@$this->array = $this->rs->GetRows();
if(count($this->array)==0||$this->rs == false)
return false;
else
return $this->array;
}
function ShowPage($contentname, $utits, $anotherserchstr, $anotherserchstrs, $class){
$allrs = $this->conn->Execute($this->sqlstr); //执行查询语句
$record = count($allrs->GetRows());//统计记录总数
$pagecount = ceil($record/$this->pagesize);//计算共有多少页
@$str.="共有".$contentname." ".$record." ".$utits." 每页显示 ".$this->pagesize.
" ".$utits." 第 ".$this->rs->AbsolutePage()." 页/共 ".$pagecount." 页";
$str.=" ";
if(!$this->rs->AtFirstPage())
$str.="<a href=".$_SERVER['PHP_SELF']."?page=1¶meter1=".$anotherserchstr."¶meter2=".
相关新闻>>
- 发表评论
-
- 最新评论 更多>>