php小代码:连接mdb数据库,取出content表中第3,4列的数据写成html
本帖最后由 zhan170 于 2015-2-26 21:02 编辑<?php
header('Content-type: text/html; charset=utf-8');
/*
文件功能:取mdb数据库数据生成html文件
*/
$conn = @new COM("ADODB.Connection") or die ("ADO连接失败!");
$connstr = "DRIVER={Microsoft Access Driver (*.mdb)};DBQ=". realpath("SpiderResult.mdb");
$conn->Open($connstr);
$rs = new com("ADODB.RecordSet");
$rs->Open("select * from Content",$conn,1,3);
$fp_write = fopen("data.html","w");
while(! $rs->eof) {
$biaoti = $rs->Fields(3)->value;
$neirong=$rs->Fields(4)->value;
fwrite($fp_write,$biaoti."<br>".$neirong."<br>");
$rs->MoveNext();
}
fclose($fp_write);
echo "<a href=data.html>打开</a>";
echo "over";
?>
目录附图
页:
[1]