基本上这里是我的php pdo插入代码
$dbName = $_SERVER["DOCUMENT_ROOT"] . "/web/admin/mindb1.mdb";
//$dbName = "mindb1.mdb";
if (!file_exists($dbName)) {
die("Could not find database file.");
}
$db = new PDO("odbc:DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=$dbName; Uid=; Pwd=;");
$sql = "INSERT INTO Anggota (`Tarikh Anggota`, `No Kp`, `No Kp Lain`) VALUES ('13/03/1970', 'b111111', 'b111111')";
$db->query($sql);
但似乎没有插入任何内容。而不是我们返回的任何错误消息。但运行如下所示的选择查询工作正常
$sql = "SELECT ID, `Tarikh`, `NoKp`, `Nama` FROM Anggota order by ID";
$result = $db->query($sql);
while ($row = $result->fetch()) {
$id = $row["ID"];
$tarikhAnggota = $row["Tarikh"];
$noKp = $row["NoKp"];
echo "id: ".$id." tarikhAnggota: ".$tarikhAnggota." noKp: ".$noKp."<Br>";
}