php连接access数据库mdb微软本地数据库
使用MDBPlus查看与管理创建CURD操作access数据库mdb
下载链接地址:http://www.alexnolan.net/software/MDBPlus.exe
MDB Viewer Plus - Open and edit MDB/Accdb files.
<?php
header('Content-Type: text/html; charset=GB2312');
$database = realpath("2.mdb");
$password = "";
$dsn = "odbc:Driver={Microsoft Access Driver (*.mdb, *.accdb)};Dbq=$database;PWD=$password;";
try {
$pdo = new PDO($dsn, '', '');
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$stmt = $pdo->query("SELECT * FROM News");
while ($row = $stmt->fetch(PDO::FETCH_ASSOC)) {
print_r($row);
}
} catch (PDOException $e) {
echo "Error: " . $e->getMessage();
}
access数据库用wps打开后,右键表导出excel,然后再将excel导入到mysql数据库表中。直接用PHP+MYSQL开发。