//php教程.ini需要开放:
//extension=php_pdo.dll
//extension=php_pdo_odbc.dll
//数据库为acc.mdb,为防止恶意下载,改为acc.php
try{
$db = new pdo("odbc:driver={microsoft access driver (*.mdb)};dbq=".getcwd()."acc.php",'aaa','123456'); //getcwd()函数是获取当前路径
//echo "connected ";
date_default_timezone_set('asia/shanghai'); //北京时间
$v="测试".date("y-m-d h:i:s")."添加的内容";
$db->exec("insert into table1(topic) values('$v')");//插入
//echo $db->lastinsertid(); //不支持
$rs=$db->query("select * from table1"); //选择
while($row=$rs->fetch()){
echo $row[id]."-".$row[topic]."
";
};
} catch (exception $e) {
//echo "failed:".$e->getmessage();
}