$pagesize = 3;//設定每頁顯示數目
//計算總記錄數
$rs_num = "select count(*) as id from table";
$rs_num = odbc_exec($conn_id,$rs_num);
$rs_num = odbc_result($rs_num,"id");
//計算總頁數
$pagecount = $rs_num / $pagesize;
$pagecount1 = intval($pagecount);//將總頁數取整
$compare = $pagecount - $pagecount1;
switch ($compare){
case "0":
$pagecount = $pagecount1;//總頁數
break;
default :
$pagecount1 ;
$pagecount = $pagecount1;//總頁數
break;
};
if ($pagecount == 0)$pagecount ;
$fpages = $pages-1;
$bpages = $ pages 1;
?>
共頁 ";?>首頁"; ?> "; ?>前頁"; ?> "; ?>後頁"; ?> "; ?> 尾頁"; ?>
|
$firstshow = ($pages-1)*$pagesize 1;//確定每頁的第一筆記錄
//找出第一條記錄的記錄號
$query_string = "SELECT * FROM table Order By id DESC";
$query_string = odbc_exec($conn_id,$query_string);
odbc_fetch_strinto($mquery_string);
);
$idsql = $idarea[0];
//定位查找
if ($pages == $pagecount) {
$rs = "SELECT * FROM table where id }else{
$rs = "SELECT Top ".$pagesize." * FROM table where id };
$rs = odbc_exec($conn_id,$rs);
//顯示記錄
while(odbc_fetch_f )){
};
?>
//關閉連線
odbc_close($conn_id);
?>
【本文版權歸作者與奧索網共同擁有,如需轉載,請註明作者及出處】
http://www.bkjia.com/PHPjc/316505.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/316505.htmlTechArticle?php $pagesize = 3;//設定每頁顯示數目//計算總記錄數$rs_num = selectize = 3;//設定每頁顯示數目//計算總記錄數$rs_num = select count(*) as id from table; $rs_num = odbc_exec($conn_id,$rs_num); $rs_num = odbc_result($rs_num,i...