Home  >  Article  >  Backend Development  >  php+oracle paging class_PHP tutorial

php+oracle paging class_PHP tutorial

WBOY
WBOYOriginal
2016-07-21 16:07:11911browse

example.php

Copy code The code is as follows:

$conn = ociplogon("test" ,"123456","test123");
include_once "pager.inc.php";
?>

Copy codeThe code is as follows:

/**Pagination test starts*/

// {{{ Initial paging object
$pager = new pager();
/**将 select id,name,age from test where age>20 order by id desc 拆分*/
$sqlArr = array('conn' => $conn, // Database link
'fields' => " id, name,age ", // Main query statement
'table' => "test", // Table name
'condition' => " age>20 ", // Query condition
' order' => " order by id desc " // Sorting method
);
if (!$pager->listn($sqlArr,10,$page)) // Display 10 items per page
{
$pager->errno = 10;
die($pager->errmsg());
}
//}}}

// {{{ Data display
for( $i = 0; $i < count($pager->result); $i++)
{
$tmp = $pager->result[$ i];
echo " id:".$tmp['ID']."
";
echo " name:".$tmp['NAME']."
" ;
echo " age:".$tmp['AGE']."
"
}
// }}}

// {{{ Show page turning Link
echo $pager->page. " / ".$pager->totalpage." Total ".$pager->total. " records";
if ($pager-> prev != 0)
echo " prev.">Previous page ";
else
echo " Previous page";

if ($pager->next != 0)
echo " next."> ;Next page ";
else
echo " Next page";
// }}}
?>


www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/315195.htmlTechArticleexample.php Copy the code as follows: ?php $conn = ociplogon("test","123456"," test123"); include_once "pager.inc.php"; ? Copy the code as follows: ?php /**Pagination test starts*/ /...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn