I'm trying to access a .mdb database file, but I cannot open a connection.
I know that the path of the file is right, I don't receive the 'Database file does not exist' error I wrote (which was popping up earlier when the file was in the wrong place).
I have been looking online for the proper way to open an ODBC connection to a Microsoft Access database, but I still can't find what is wrong with my code.
PHP Code:
$dbq = "db/hsc.mdb";
if (!file_exists($dbq))
{
echo "Sorry!<br />Database file: <b>$dbq does not exist</b>";
}
$db_conn = odbc_connect("Driver={Microsoft Access Driver (*.mdb)};Dbq=$dbq", $username, $password,'SQL_CUR_USE_ODBC');
$this->db_connection = $db_conn;
if($db_conn){echo "Yay! there is a connection!";}
else{echo "There is no connection :(";}
When the code runs, I get the error message "There is no connection :(" because $db_conn is 0. How do I fix this?