php+oracle paging class_PHP tutorial

WBOY
Release: 2016-07-13 17:22:48
Original
1119 people have browsed it

The following is a paging example program. It may seem complicated, but in fact, as long as you use it, you will find that "everything is so simple" :)
example.php
$conn = ociplogon( "test","123456","test123");
include_once "pager.inc.php";
?>
/**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 connection
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 result); $i++)
{
$tmp = $pager->result[$i];
echo " id:".$tmp[ ID]."
";
echo " name:".$tmp[NAME]."


";
echo " age:".$tmp[AGE]."
"
}
// }}}
// {{{ Display 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";
// }}}
?>
@OCILogoff($conn)?>

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/532308.htmlTechArticleThe following is a paging sample program. It may seem complicated, but in fact, as long as you use it, you will find that everything is original. So easy :) example.php $conn = ociplogon(test,123456,test123)...
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template