I am trying to read MDB data in my Codeigniter project. But it not working for me. I have followed this code:
Applying Code:
<?php $mdb_file = APPPATH.'database/myfile.mdb'; $uname = explode(" ",php_uname()); $os = $uname[0]; switch ($os){ case 'Windows': $driver = '{Microsoft Access Driver (*.mdb)}'; break; case 'Linux': $driver = 'MDBTools'; break; default: exit("Don't know about this OS"); } $dataSourceName = "odbc:Driver=$driver;DBQ=$mdb_file;"; $connection = new \PDO($dataSourceName); $result = $connection->query($query)->fetchAll(\PDO::FETCH_ASSOC); print_r($result); ?>
Error:
Type: PDOException
Message: SQLSTATE[01000] SQLDriverConnect: 0 [unixODBC][Driver Manager]Can’t open lib ‘MDBTools’ : file not found
Filename: /home/thedtech/domains/example.com/public_html/MyProject/application/controllers/Controller.php
Line Number: 30
Backtrace:
File: /home/example/domains/example.com/public_html/MyProject/application/controllers/Controller.php
Line: 30
Function: __construct
File: /home/example/domains/example.com/public_html/MyProject/index.php
Line: 315
Function: require_once
Question and answer is powered by AnsPress.io