How PHP connects to an Access database _php tutorial

Source: Internet
Author: User
Tags dsn
D:accessdb1.mdb
User name: Admin
Password: 123
How can I establish a connection with this file in PHP

---------------------------------------------------------------

The first approach is to use ODBC to build a system data source for Db1.mdb in the ODBC governance
Name: DBDSN (can be determined by oneself)
Driver: Microsoft Access Driver (*. MDB)

Code:
...
$Conn = Odbc_connect ("Dbdsn", "admin", "123"); Connecting to a data source
$Doquery =odbc_exec ($Conn, "select * from table name where Condition");//Execute Query
...


The second way is ADO
...
$conn =new COM ("ADODB. Connection ");
$DSN = "Driver={microsoft Access DRIVER (*.mdb)};D bq=". Realpath ("Path/db1.mdb");
$conn->open ($DSN);
$sql = "SELECT * from table name where condition";
$ru = $conn->execute ($sql);

http://www.bkjia.com/PHPjc/630930.html www.bkjia.com true http://www.bkjia.com/PHPjc/630930.html techarticle d:accessdb1.mdb Username: Admin Password: 123 How can I establish a connection with this file in PHP------------------------------------------------------------ ---The first way is to use ODBC ...

  • Related Article

    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.