读取MDB数据库 - 翼展电脑服务中心


PHP读取MDB数据库实例教程

2018-3-31 乱云飞 代码 评论(0) 浏览(1092) 标签: php代码 读取MDB数据库

<?php //读取mdb数据库例程
$conn = new com("ADODB.Connection");
$connstr = "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=". realpath("000.mdb");//数据库名
$conn->Open($connstr);
$rs = new com("ADODB.RecordSet");
$rs->Open("select * from yao_article",$conn,1,1);//数据表名
while(! $rs->eof) {
$f = $rs->Fields(0);//从第0列开始输出
echo "<font color=red>  ID  </font>".$f->value;
echo "<font color=red>标题</font>". $rs->Fields(1)->value;
echo "<font color=red>颜色</font>". $rs->Fields(2)->value;
echo "<font color=red>作者</font>". $rs->Fields(3)->value;
echo "<font color=red>来源</font>". $rs->Fields(4)->value;
echo "<font color=red>栏目</font>". $rs->Fields(5)->value;
echo "<font color=red>关键字</font>". $rs->Fields(6)->value;
echo "<font color=red>第七列</font>". $rs->Fields(7)->value;
$rs->MoveNext();
echo "<hr>";
}
?>
预ICP备10086-001号 © 翼展网/80C.CC 技术支持/洛阳翼展科技
TEL / 13213610060 QQ / 345794501
Powered by emlog