Home > php教程 > php手册 > php 连接 access数据库与修改 删除 增加 数据实例

php 连接 access数据库与修改 删除 增加 数据实例

WBOY
Release: 2016-06-13 10:08:18
Original
1079 people have browsed it

php教程 连接 access数据库教程与修改 删除 增加 数据实例
本文章提供一款php 连接 access数据库与修改删除增加数据实例哦,首页我们来告诉你利用php 连接 access数据库然后再增加,修改,编辑,显示删除以及数据的分页效果源码。
*/

$conn = new com("adodb.connection");
$conn->open("driver={microsoft access driver (*.mdb)}; dbq=".db_path.";uid=;pwd=;");

$rs=new com("adodb.recordset");
$rs->open("select * from [article] order by [articleid]",$conn,1,3);
$rs->pagesize=5;
$page=trim($_get['page']);
if($page=="" || is_numeric(intval($page))$rs->pagecount){$page=$rs->pagecount;}
$page=intval($page);
if(!$rs->eof||$rs->bof){
 $rs->absolutepage=$page; $mypagesize=$rs->pagesize; $i=$rs->recordcount()-($page-1)*$rs->pagesize; 
 while(!$rs->eof && $mypagesize>0 && $i>=$rs->recordcount()-1-$rs->pagesize*$page){
  $articleid = $rs->fields(0)->value;
  $articletitle = $rs->fields(1)->value; ?>
  

  • echo $articletitle; ?> echo $articlei; ?>

  •    $rs->movenext; $mypagesize--; $i--;  } } ?>
        
       
      
      

       头页 上页 下页 尾页  共 echo $rs->recordcount(); ?>篇文章,分 echo $rs->pagecount;?>页显示,现在是第 echo $page;?>页
      

     
    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 Recommendations
    Popular Tutorials
    More>
    Latest Downloads
    More>
    Web Effects
    Website Source Code
    Website Materials
    Front End Template