How does php connect to the access database?

Source: Internet
Author: User
How does php connect to the access database?
I would like to share a php code for connecting to the access database. there are multiple methods for connecting the php code to access. you can use these methods through instances.

  1. */
  2. // Use pdo to connect to the access Database
  3. $ Path = "f: fontbbs. it-home.orgspiderresult.mdb ";
  4. $ Conn = new pdo ("sqlite: $ path ");
  5. If ($ conn)
  6. {
  7. Echo ('connection pdo success ');
  8. }
  9. Else
  10. {
  11. Echo ('cnnection pdo fail, plase check database server! ');
  12. }
  13. // Use odbc_connect to connect to the database
  14. $ Conn = odbc_connect ("dbdsn", "admin", "123"); // connect to the data source
  15. $ Doquery = odbc_exec ($ conn, "select * from table name where Condition"); // execute the query
  16. // Use the com interface to connect to the access Database
  17. $ Conn = new com ("adodb. connection ");
  18. $ Dsn = "driver = {microsoft access driver (*. mdb)}; dbq =". realpath ("path/db1.mdb ");
  19. $ Conn-> open ($ dsn );




Access, database

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.