How can we connect a PHP script to MS Access (.mdb) file?
I tried by including following PHP code:
$db_path =
I'm not certain if this is a violation of best practices or security, but I would like to throw out this suggestion:
set up an ODBC connection and include the database's password in the odbc advance settings. give the odbc conn a DSN name then save.
in your code, just set up the connection like:
try {
$conn = @odbc_connect("DSNName", "", "", "SQL_CUR_USE_ODBC");
// un and pw parameters are passed as empty strings since the DSN
// has knowledge of the password already.
// 4th parameter is optional
$exec = @odbc_exec($conn, $insert) or die ("exec error");
echo "success!";
}
catch (Exception $e) {
echo $e->getMessage();
} // end try catch