php教程 access 數據連接與讀取保存數據解析
$conn = new com("ADODB.Connection");
$connstr = "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=". realpath("www.bkjia.com/db.mdb");
//與access連接要用到com接口了。
$conn->Open($connstr);
$rs = new com("ADODB.RecordSet");
//數據查詢並顯示出來
$rs->Open("select * from szd_t",$conn,1,1);
while(! $rs->eof) {
$f = $rs->Fields(1);
echo $f->value;
$rs->MoveNext();
}
//下面來看一下php access數據庫教程保存
$sql ="insert into szd_t(title)values('www.bkjia.com')";
$rs->Open( $sql );
echo '保存成功';
//php access數據庫編輯
$sql ="Update szd_t set title="php100.com" where id=".$_GET['id'];
$rs->Open( $sql );
echo '編輯成功';
//刪除數據
$sql ="delete from szd_t where id=".$_GET['id'];
//本文章原創於www.bkjia.com,轉載注明出處