Home  >  Article  >  php教程  >  php adodb分页实现代码

php adodb分页实现代码

WBOY
WBOYOriginal
2016-06-13 12:24:07696browse

复制代码 代码如下:


include("adodb/adodb.inc.php"); //包含adodb类库文件
include("adodb/adodb-pager.inc.php"); //包含adodb-pager类库文件
$conn = NewADOConnection('mysql'); //创建adodb对象,声明数据库类型为MySQL
$conn->Connect("localhost", "root", "1981427", "test"); //连接数据库,其中mydb为数据库名
$sql = "select * from tablename1"; //定义要执行的SQL语句

$pager = new ADODB_Pager($conn, $sql); //根据连接对象和SQL语句创建分页对象
$pager->Render(3); //输出分页的页面,每页3条记录
?>



复制代码 代码如下:


include("adodb/adodb.inc.php"); //包含adodb类库文件
include("adodb/adodb-pager.inc.php"); //包含adodb-pager类库文件
$conn = NewADOConnection('mysql'); //创建adodb对象,声明数据库类型为MySQL
$conn->Connect("localhost", "root", "1981427", "test"); //连接数据库,其中mydb为数据库名
$sql = "select id as '编号', username as '姓名', password as '密码' from tablename1"; //定义要执行的SQL语句

$pager = new ADODB_Pager($conn, $sql); //根据连接对象和SQL语句创建分页对象
$pager->Render(2); //输出分页的页面,每页2条记录
?>

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