Extracting Data from a .mdb file to mysql database using php
mysql, php, yii
Solution
Use odbc_connect() function using a database source name (DSN). Alternatively, a DSN-less connection string can be used.
DSN-less connections
if no password, leave username as "sa" and password blank.
$conn = odbc_connect("Driver={Microsoft Access Driver (*.mdb)};Dbq=$mdb_file", $user, $password);
To Connect with DSN
from *http://www.w3schools.com/php/php_db_odbc.asp*
Open the Administrative Tools icon in your Control Panel Double-click on the Data Sources (ODBC) icon inside. Choose the System DSN tab. Click on Add in the System DSN tab. Select the Microsoft Access Driver. Click Finish. In the next screen, click Select to locate the database. Give the database a Data Source Name (DSN). Click OK.
$conn = odbc_connect($dsn_name, $user, $password);
Query:
$res = odbc_exec($conn, "select * from table");
List results:
while( $row = odbc_fetch_array($res) ) {
print_r($row);
}
More info: http://www.php.net/manual/en/ref.uodbc.php
Problem
Possible Duplicate: Access from PHP to .mdb file on Ubuntu Hi I'm developing a webstore using the php framework yii.. I want to upload a .mdb file to our system, and extract data from it and insert into mysql database.. Is there anyway of doin this? It'll be great if someone could help me out. Thanks