PHP代码:
- <?php
- $connstr="DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" .realpath("data.mdb");
- $connid=odbc_connect($connstr,"","",SQL_CUR_USE_ODBC);
- $issuetime=date("Y-m-d H:i:s");
- $sql="insert into test values("","",...)";
- $result=odbc_exec($connid,$sql);
- if($result) echo "successful";
- else echo "failed";
- ?>
之二:
- <?PHP
- //创建ADO连接
- $conn = @new COM("ADODB.Connection") or die ("ADO连接失败!");
- $connstr = "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" .realpath("temp/TempData.mdb");
- $conn->Open($connstr);
- //创建记录集查询
- $rs = @new COM("ADODB.RecordSet");
- $rs->Open("select * from blog_Content",$conn,1,3);
- echo $rs->Fields["log_Title"]->Value; //输出log_Title字段
- echo "<br/>";
- $rs->Movenext(); //将记录集指针下移
- echo $rs->Fields["log_Title"]->Value;
- $rs->close();
- ?>