class Pages{
var $cn; //Connect the database cursor
var $d; //Connect the data table Cursor
var $result; //Result
var $dsn; > var $total; //Total number of records
var $pages; //Total number of pages
var $onepage; //Number of entries per page
var $page; //Previous page
var $net; //Next page
var $i; 🎜> $this->cn=@odbc_connect($dsn,$user,$pass);
if(!$this->cn){
$error="Error connecting to database";
@odbc_do($this->cn,$sql);
If(!$this->d){
$error="A small error occurred during query...";
$this->getMess($error); $this ->sql=$sql;
$dT=$this->getDo($this->sql); 'total');//Why can't $this->d be used here?
return $this->total;
}
function getList($sql,$onepage,$page){
$this->s=$sql;
$this->onepage=$onepage;
$this->page=$page;
$this->dList=$this->getDo($this->s); // Cursor for joining table
$this->pages=ceil($this->total/$this->onepage);
if($this->pages==0)
$ this->pages++; //Cannot get page 0
if(!isset($this->page))
$this->page=1;
$this-> fre = $this->page-1; //The number of pages to be displayed
->page-1)*$this->onepage;
//if($this->nums!=0){
this->i<$pg->getNums();odbc_fetch_row($this->dd),$this->i++);//Same as above
>i=0;//Why can’t this part be encapsulated?
return $this->dList;
}
function getFanye(){
$str="";
if($this->page!=1)
$str.=" 首页 fre."> 前页 ";
else
$str.="首页 前页";
if($this->page<$this->pages)
$str.="nxt."> 后页 ";
else
$str.=" 后页 ";
if($this->page!=$this->pages)
$str.="pages."> 尾页 ";
else
$str.=" 尾页 ";
$str.="共".$this->pages."页";
$str.="您正浏览第".$this->page."页";
return $str;
}
function getNums(){
return $this->nums;
}
function getOnepage(){//每页实际条数
return $this->onepage;
}
function getI(){
return $this->i;
}
function getPage(){
return $this->page;
}
function getMess($error){//定制消息
echo"