PHP Tutorial connecting Access database Tutorial code
Here are three kinds of PHP connection Access database methods, one is to use PHP's PDO, one is the Odbc,com interface to connect with the Access database Oh.
*/
Connecting to an Access database with PDO
$path = "F:fontwww.111cn.netspiderresult.mdb";
$conn = new PDO ("SQLite: $path");
if ($conn)
{
Echo (' Connection PDO success ');
}
Else
{
Echo (' Cnnection PDO fail, plase check Database server! ');
}
Connecting a database using Odbc_connect
$conn = Odbc_connect ("Dbdsn", "admin", "123"); Connecting to a data source
$doquery =odbc_exec ($conn, "select * from table name where Condition");//Execute query//Connect Access database with COM interface
$conn =new com ("adodb.connection");
$DSN = "Driver={microsoft Access Driver (*.mdb)};d bq=". Realpath ("Path/db1.mdb");
$conn->open ($DSN);