用php+oracle实现分页的示例程序
程序员文章站
2022-04-06 09:21:56
...
oracle|程序|分页|示例
include "/maya/inc/dbconn.php";
$sql="select max(rownum) from xqhtest where id$stmt=ociparse($gConn,$sql);
ociexecute($stmt);
ocifetch($stmt);
$rowcount=ociresult($stmt,1);
ocifreestatement($stmt);
echo("共有".$rowcount."条记录
\n");
$recordperpage=15; //每页显示多少条记录
$pages=ceil($rowcount/$recordperpage); //总页数
echo("共有".$pages."页
\n");
?>
id | name |
".ociresult($stmt2,"ID")." | ".ociresult($stmt2,"NAME")." |
";
for ($i=1; $i {
$newoffset=($recordperpage*($i-1))+1;
print "$i \n";
}
print "
";
$nextoffset=$recordperpage*$currentpage+1;
$prevoffset=$recordperpage*($currentpage-2)+1;
//判断是否需要上一页连接
if (($currentpage>1) && ($currentpage{
print "上一页 \n";
}
//判断是否需要下一页连接
if (($pages!=0) && ($currentpage{
print "下一页 \n";
}
ocifreestatement($stmt2);
ocilogoff($gConn);
?>
上一篇: IMAP安装