时间:2021-07-01 10:21:17 帮助过:3人阅读
$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,转载注明出处
http://www.bkjia.com/PHPjc/444945.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/444945.htmlTechArticlephp教程 access 数据连接与读取保存数据解析 $conn = new com(ADODB.Connection); $connstr = DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=. realpath(www.bkjia.com/db.mdb...