主頁 > 知識(shí)庫 > PHP ADODB實(shí)現(xiàn)分頁功能簡單示例

PHP ADODB實(shí)現(xiàn)分頁功能簡單示例

熱門標(biāo)簽:遼寧ai電銷機(jī)器人價(jià)格 上海做外呼線路的通信公司 長沙做地圖標(biāo)注公司 四川保險(xiǎn)智能外呼系統(tǒng)供應(yīng)商 寧波外呼營銷系統(tǒng) 地圖標(biāo)注專員怎么樣 福建銀行智能外呼系統(tǒng)價(jià)格 電話機(jī)器人銷售主要負(fù)責(zé)什么 房產(chǎn)中介用的是什么外呼系統(tǒng)

本文實(shí)例講述了PHP ADODB實(shí)現(xiàn)分頁功能。分享給大家供大家參考,具體如下:

一、代碼

adodb.inc.php可從官方網(wǎng)站http://adodb.sourceforge.net/ 下載。

或者點(diǎn)擊此處本站下載。

conn.php:

?php
 include_once ('../adodb5/adodb.inc.php');
 $conn = ADONewConnection('mysql');
 $conn -> PConnect('localhost','root','root','db_database14');
 $conn -> execute('set names gb2312');
?>

list.php:

!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=gb2312" />
title>分頁技術(shù)/title>
style type="text/css">
!--
TH {
background-color:#FFFFFF;
 font-size: 12px;
 color: #FF0000;
}
td {
background-color:#FFFFFF;
 font-size: 12px;
 color: #FF0000;
}
a:link {
 color: #FF0000;
 text-decoration: none;
}
a:visited {
 text-decoration: none;
 color: #FF0000;
}
a:hover {
 text-decoration: none;
}
a:active {
 text-decoration: none;
}
-->
/style>
/head>
body>
table width="384" border="0" cellpadding="0" cellspacing="0">
 tr>
 td height="30">
 ?php
 include_once 'conn/conn.php';     //載入數(shù)據(jù)庫鏈接文件
 include('../adodb5/tohtml.inc.php');   //載入tohtml.inc.php文件
 $sql = 'select * from tb_object';    //查詢語句
 $num = 2;          //每頁顯示的記錄數(shù)
 if(isset($_GET['n_page'])){      //判斷當(dāng)前頁碼
  $c_page = $_GET[n_page];     //將$n_page賦給變量$c_apge
 }else{
  $c_page = 1;        //初始化變量$c_page
 }
 $rst = $conn -> PageExecute($sql,$num,$c_page); //執(zhí)行pageExecute函數(shù)
 if(false != $rst){
  if(!$rst -> AtfirstPage()){     //如果當(dāng)前頁不是首頁
?>!-- 輸出向上翻頁超鏈接 -->
  a href ="?php echo '?n_pge=1' ?>"> 首頁 /a>
  a href ="?php echo '?n_page='.($rst -> AbsolutePage() - 1); ?>"> 上一頁 /a>
!-- ---------------------------- -->
?php
  }
  if(!$rst -> AtlastPage()){     //如果當(dāng)前頁不是尾頁
?>
!-- 輸出向下翻頁超鏈接 -->
  a href = "?php echo '?n_page='.($rst -> AbsolutePage() + 1); ?>"> 下一頁 /a>
  a href ="?php echo '?n_page='.($rst -> LastPageNo());?>"> 尾頁 /a>
!-- ----------------------------- -->
?php
  }
?>/td>
 /tr>
 tr>
 td>?php
  rs2html($rst,'width=350 border="1" cellpadding="1" cellspacing="1" bordercolor="#FFFFFF" bgcolor="#FF0000"',array('ID','類型','添加時(shí)間'));
 ?>/td>
 /tr>?php }?>
 tr>
 td height="30">當(dāng)前是第?php echo $rst -> AbsolutePage(); ?>頁/一共是?php echo $rst -> LastPageNo(); ?>頁/td>
 /tr>
/table>
/body>
/html>

二、運(yùn)行結(jié)果

更多關(guān)于PHP相關(guān)內(nèi)容感興趣的讀者可查看本站專題:《php+mysql數(shù)據(jù)庫操作入門教程》、《PHP基于pdo操作數(shù)據(jù)庫技巧總結(jié)》、《PHP+MongoDB數(shù)據(jù)庫操作技巧大全》、《php+Oracle數(shù)據(jù)庫程序設(shè)計(jì)技巧總結(jié)》、《php+mssql數(shù)據(jù)庫程序設(shè)計(jì)技巧總結(jié)》、《php+redis數(shù)據(jù)庫程序設(shè)計(jì)技巧總結(jié)》、《php+mysqli數(shù)據(jù)庫程序設(shè)計(jì)技巧總結(jié)》及《php常見數(shù)據(jù)庫操作技巧匯總》

希望本文所述對(duì)大家PHP程序設(shè)計(jì)有所幫助。

您可能感興趣的文章:
  • PHP ADODB實(shí)現(xiàn)事務(wù)處理功能示例
  • PHP程序中使用adodb連接不同數(shù)據(jù)庫的代碼實(shí)例
  • php中adodbzip類實(shí)例
  • PHP數(shù)據(jù)庫萬能引擎類adodb配置使用以及實(shí)例集錦
  • php adodb連接不同數(shù)據(jù)庫
  • 常用的php ADODB使用方法集錦
  • PHP中ADODB類詳解
  • 用ADODB來讓PHP操作ACCESS數(shù)據(jù)庫的方法
  • PHP ADODB生成HTML表格函數(shù)rs2html功能【附錯(cuò)誤處理函數(shù)用法】

標(biāo)簽:工商登記 宜春 佛山 常德 宿遷 延安 深圳 澳門

巨人網(wǎng)絡(luò)通訊聲明:本文標(biāo)題《PHP ADODB實(shí)現(xiàn)分頁功能簡單示例》,本文關(guān)鍵詞  PHP,ADODB,實(shí)現(xiàn),分頁,功能,;如發(fā)現(xiàn)本文內(nèi)容存在版權(quán)問題,煩請(qǐng)?zhí)峁┫嚓P(guān)信息告之我們,我們將及時(shí)溝通與處理。本站內(nèi)容系統(tǒng)采集于網(wǎng)絡(luò),涉及言論、版權(quán)與本站無關(guān)。
  • 相關(guān)文章
  • 下面列出與本文章《PHP ADODB實(shí)現(xiàn)分頁功能簡單示例》相關(guān)的同類信息!
  • 本頁收集關(guān)于PHP ADODB實(shí)現(xiàn)分頁功能簡單示例的相關(guān)信息資訊供網(wǎng)民參考!
  • 企业400电话

    智能AI客服机器人
    15000

    在线订购

    合计11份范本:公司章程+合伙协议+出资协议+合作协议+股权转让协议+增资扩股协议+股权激励+股东会决议+董事会决议

    推薦文章