I am getting this error:
Type: PDOException
Message: SQLSTATE[01000] SQLDriverConnect: 0 [unixODBC][Driver Manager]Can’t open lib ‘Microsoft Access Driver (*.mdb)’ : file not found
Filename: /home/example/domains/example.com/public_html/MyProject/application/controllers/Controller.php
Line Number: 23
Backtrace:
File: /home/example/domains/example.com/public_html/MyProject/application/controllers/Controller.php
Line: 23
Function: __construct
File: /home/example/domains/example.com/public_html/MyProject/index.php
Line: 315
Function: require_once
My Code:
<?php $dbname = APPPATH.'database/myFile.mdb'; if (!file_exists($dbname)) { die("Could not find database file."); } try { $dbname = APPPATH.'database/myFile.mdb'; $dbh = new PDO("odbc:Driver={Microsoft Access Driver (*.mdb, *.accdb)};Dbq=$dbname;Uid=; Pwd=;"); $dbh = null; } catch (PDOException $e){ echo $e->getMessage(); } ?>
I have tried to got MDB data and save it into my MySQL database, but it not working.
Question and answer is powered by AnsPress.io