Home > Backend Development > PHP Tutorial > php adodb分页实现代码_PHP

php adodb分页实现代码_PHP

WBOY
Release: 2016-06-01 12:23:48
Original
876 people have browsed it
复制代码 代码如下:
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条记录
?>
Related labels:
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