PHP Connect ODBC data source and save and query data method, phpodbc_php tutorial

Source: Internet
Author: User
Tags echo date

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. ...

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.