Php connects to the odbc data source and saves and queries data. Php connects to the odbc data source and saves and queries data. this example describes how php connects to the odbc data source and saves and queries data. Share it with you for your reference. Using php to connect to the odbc data source and save and query data, phpodbc
This example describes how to connect php to the odbc data source and save and query data. Share it with you for your reference.
The specific implementation code is as follows:
The code is as follows:
$ Connstr = "driver = microsoft access driver (*. mdb); dbq =". 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); dbq =". realpath ("db. mdb ");
$ Connid = odbc_connect ($ connstr, "", "", SQL _cur_use_odbc );
$ Odbc_exec = odbc_exec ($ connid, "insert into t ...... ")
// Query 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 will help you with php programming.
Examples in this article describes how to connect php to the odbc data source and save and query data. Share it with you for your reference. With...