时间:2021-07-01 10:21:17 帮助过:24人阅读
try{
$db = new pdo("odbc:driver={microsoft access driver (*.mdb)};dbq=".getcwd()."\acc.php",'aaa','123456'); //getcwd()函数是获取当前路径
//echo "connectedn";
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();
}
http://www.bkjia.com/PHPjc/630841.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/630841.htmlTechArticlepdo连接access数据库教程代码 //php教程.ini需要开放: //extension=php_pdo.dll //extension=php_pdo_odbc.dll //数据库为acc.mdb,为防止恶意下载,改为acc.php t...