Re: Querying Access DB from MySQL
Hi Stacy
I have pc with LAMP insalled.
I have used the following function to connect to an accesss database from the server using PHP.
the $sql_query variable contains the query to the accessdata base.
After reading the the access file I will write to Mysql database.
This will only work for php under windows OS.
$sql_query="Select test_person_id from ki_test_persons";
save_datato_acces($sql_query);
function save_datato_acces($sql_query)
{
$db_connection = new COM("ADODB.Connection", NULL, 1252);
$db_connstr = "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=C:\\xampp\\htdocs\\test\\ki.mdb;DefaultDir=C:\\xampp\\htdocs\\test";
$db_connection->open($db_connstr);
$rs = $db_connection->execute($sql_query);
while (!$rs->EOF){
$test_person_id = $rs->Fields[0]->value;
tep_db_query("INSERT INTO ki_test_person_id_from_access (test_person_id) values (" . $test_person_id . ")");
$rs->MoveNext();
}
$db_connection->Close();
}
Subject
Views
Written By
Posted
3474
November 09, 2009 10:01AM
Re: Querying Access DB from MySQL
2219
December 02, 2009 05:57AM
Sorry, you can't reply to this topic. It has been closed.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion
of Oracle or any other party.