class Pages{
var $cn; //連結資料庫遊標 var $result; //結果
var $dsn; //dsn來源
var $pass; //密碼
var $total; //記錄總數
var $pages; //總頁數
var $onepage; var $fre; //上一頁
var $net; //下一頁
var $i; ,$pass){
$ this->cn=@odbc_connect($dsn,$user,$pass);
if(!$this->cn){
$this-> getMess($error);
}
}
function -> cn,$sql);
if(!$this->d){
$error=" error);
}
return $this->d;
} $this->sql=$sql;
$ dT=$this->getDo($this->sql); //求總數的遊標
$this->total=odbc_result($dT,'total');呢?
return $this->total;
}
function $this ->onepage=$onepage;
$this->page=$page;
$this-> $this->pages=ceil($this->total/$this->onepage);
if($this->pages==0)
0頁
if(!isset($this->page))
$this->page //將顯示的頁數
$this->nxt = $this->page 1;
$this->nums=($ $this->nums!=0){
// for($this->i=0;$this->igetNums();odbc_fetch_row($this->igetNums();odbc_fetch_row($this->igetNums();odbc_fetch_row($this-> ->i );//同上
//}
//$this->i=0;//為何這部分不能封裝?
return $this->dList;
}
function getFanye(){
$str="";
this $str="";
this $str="";> $str.=" 首頁fre.">前頁";
else
$str.="首頁前頁";
)$1 $str.="nxt.">後頁";
else
";
if($this->page!=$this->pages)
$str.=”尾頁";
其他
$str.="共".$this->pages."頁";
$str.="您正在瀏覽第".$this->page."頁";
return $str;
}
function getNums(){
page(){//每頁條實際數
返回$this->onepage;
}
函數getPage() {
返回$this->page;
}
function getMess($error){////
}
}
$pg=new Pages();
$pg->getConnect("lei","sa","")); $pg->getTotal("選擇count(*) 總共來自xs"); //連學生表中求總數
$pg->getList("select xs_name from xs page by xs_id",8,$pages_name from xs page by xs_id",$page by xs_idorder ;
if($pg->getNums()!=0){
for($i=0;$igetNums();odbc_fetch_row($pg->dList), $i ) ;//同上
}
$i=0;
while(odbc_fetch_row($pg->dList)){
$name=odbc_result($pg->dList, "xs_name");
echo $name."
";
if($i==$pg->getOnepage()){//跳出迴圈
}
echo$pg->getFanye();
?>
http://www.bkjia.com/PHPjc/314636.html
www.bkjia.com
true
http: //www.bkjia.com/PHPjc/314636.html
TechArticle
!--二泉.net -- ? class Pages{ var $cn;//連接資料庫遊標 var $d;//連接資料表的遊標 var $result;//結果 var $dsn;//dsn來源 var $user;//使用者名稱 var $pass; // 密碼 var...