Home > Backend Development > PHP Tutorial > How to connect Access database with PHP_PHP tutorial

How to connect Access database with PHP_PHP tutorial

WBOY
Release: 2016-07-13 17:03:40
Original
1196 people have browsed it

D:Accessdb1.mdb
Username: Admin
Password: 123
Please tell me how to establish a connection with this file in PHP

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

The first way is to use ODBC and create a system data source for db1.mdb in the ODBC manager
Name: dbdsn (you can decide it yourself)
Driver:Microsoft Access Driver (*.MDB)

Code:
...
$Conn = odbc_connect("dbdsn","admin","123"); //Connect to 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)};DBQ=".realpath("path/db1.mdb");
$conn->open($dsn);
$sql="select * from table name where condition";
$ru=$conn->Execute($sql);

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/630930.htmlTechArticleD:Accessdb1.mdb Username: Admin Password: 123 How to establish a connection with this file in PHP --- -------------------------------------------------- ---------- The first way is to use ODBC...
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template