PHP Connect to access

Source: Internet
Author: User

PHP connection Access There are many ways, ODBC extension is open by default, is also easy to succeed, PDO method needs to open PDO extension;

1,php connecting access using ODBC extensions

<?php//requires drive path, database name, database password $driver= "Driver=microsoft Access Driver (*.mdb);d bq=". Realpath ("./database/ Tomonitor8.mdb "), $database _name=" ", $database _password=" 20121110 "; $cn =odbc_connect ($Driver, $database _name,$ DATABASE_PASSWORD,SQL_CUR_USE_ODBC) or Die (Odbc_errormsg ());//Use one sentence to connect, but it is not easy to understand which//$CN =odbc_connect ("driver= Microsoft Access Driver (*.mdb);d bq= "//. Realpath ('./database/tomonitor8.mdb ')," "," 20121110 ", Sql_cur_use_odb C) or Die (Odbc_errormsg ()); $rs = Odbc_exec ($CN, "select * from logs_he20100618 where logs_time like '%2014-07-15 17:00:00 The while (Odbc_fetch_row ($rs)) {//odbc_result ($rs, ' column name ') also supports Echo Odbc_result ($rs, 1). ' '. Odbc_result ($rs, 2). ' <br> ';} Odbc_free_result ($rs); Odbc_close ($CN);


PHP Connect to access

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.