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))<=0){$page=1;}else if(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; ?>
<li><a href="detail.php?id=<? echo $articleid; ?>"><? echo $articletitle; ?></a><span><? echo $articlei; ?></span></li>
<? $rs->movenext; $mypagesize--; $i--; } } ?>
</ul>
</div>
</div>
<div id="page">
<a href="index.php?page=1">頭頁</a> <a href="index.php?page=<? if($page>1){echo $page-1;}else{echo 1;}?>">上頁</a> <a href="index.php?page=<? if($page<$rs->pagecount){echo $page+1;}else{echo $rs->pagecount;}?>">下頁</a> <a href="index.php?page=<? echo $rs->pagecount;?>">尾頁</a> 共<? echo $rs->recordcount(); ?>篇文章,分<? echo $rs->pagecount;?>頁顯示,現在是第<? echo $page;?>頁
</div>
<!--
源碼下載
http://down.bKjia.c0m/down/code/php/cmswenzhang/2010/1028/21478.html