example.php
複製程式碼 程式碼如下:
$conn = ociplogon("test", "123456","test123");
include_once "pager.inc.php";
?>
複製程式碼
複製程式碼
複製程式碼
複製程式碼
複製程式碼
複製程式碼
複製程式碼
複製碼🎜> 程式碼如下:
/**分頁測驗開始*/
// {{{ 初始分頁物件
$pager = new pager ();
/**將 select id,name,age from test where age>20 order by id desc 拆分*/
$sqlArr = array('conn' => $conn, // 資料庫連結
'fields' => " id,name,age ", // 查詢主語句
'table' => "test", // 表名
'condition' => " age>20 ", // 查詢條件
'order' => " order by id desc " // 排序方式
);
if (!$pager->listn($sqlArr,10,$page)) // 每頁顯示10條
{
$pager- >errno = 10;
die($pager->errmsg());
}
//}}}
// {{{ 資料顯示for( $ i = 0; $i result); $i )
{
$tmp = $pager->result[$i];
echo " id:".$tmp ['ID']."
"; echo " name:".$tmp['NAME']."
";
echo " age:".$tmp['AGE' ]."
" }
// }}} // {{{ 顯示翻頁鏈結echo $pager->page. " / ".$ pager->totalpage." 共".$pager->total. "筆記錄";
if ($pager->prev != 0) echo "
prev.">上一頁 ";
else echo " 上一頁";
if ($pager->next != 0) echo "
next.">下一頁 "; echo " 下一頁"; // }}} ?> @OCILogoff($conn)?>
http://www.bkjia.com/PHPjc/315195.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/315195.htmlTechArticleexample.php 複製程式碼如下: ?php $conn = ociplogon("test","123456"," test123"); include_once "pager.inc.php"; ? 複製程式碼如下: ?php /**分頁測驗開始*/ /...