PHP connects ODBC data sources and saves and queries data in a way that PHPODBC
This example describes how PHP connects to an ODBC data source and saves and queries data. Share to everyone for your reference.
The specific implementation code is as follows:
Copy CodeThe code is as follows:
$CONNSTR = "Driver=microsoft Access Driver (*.mdb);d bq=". Realpath ("Db.mdb");
$connid = Odbc_connect ($connstr, "", "", SQL_CUR_USE_ODBC);
$odbc _exec = odbc_exec ($connid, "INSERT INTO TableName (name) VALUES (' name ')");
$query = Odbc_do ($connid, "SELECT * from TableName");
$odbc _result_all = Odbc_result_all ($query);
echo $odbc _result_all;
Save data
$CONNSTR = "Driver=microsoft Access Driver (*.mdb);d bq=". Realpath ("Db.mdb");
$connid = Odbc_connect ($connstr, "", "", SQL_CUR_USE_ODBC);
$odbc _exec = odbc_exec ($connid, "insert into t ...")
Querying data
$a = 0;
$begintime = time ();
while ($a <100)
{
$conn = Odbc_connect ("forphp", "sa", "sa");
odbc_select_db ("[Testyouhui]", $conn);
$result = Odbc_exec ("SELECT [ID], [name] from [test1].[ DBO]. [Category], $conn);//Open Source code phpfensi.com
$a + +;
Odbc_close ($conn);
}
$endtime = time ();
echo $begintime. "
";
echo $endtime. "
";
echo Date (' U second ', $endtime-$begintime);
Echo '
';
I hope this article is helpful to everyone's PHP programming.
http://www.bkjia.com/PHPjc/932490.html www.bkjia.com true http://www.bkjia.com/PHPjc/932490.html techarticle PHP connects ODBC data sources and saves and queries the data, PHPODBC This example describes how PHP connects to ODBC data sources and saves and queries data. Share to everyone for your reference. ...