PHP connect to an Access database
This article introduces you to the use of ADO in PHP to link Access database methods of the example, very simple to use, recommended for the needs of small partners to refer to.
Because the previous pingswitch to do a Web presentation of the front end, because the first use of Delphi and access structure, and the connection between Delphi and MySQL is relatively troublesome, and finally can only choose the combination of php+access, more strange, but also reasonable
To connect to an Access database in PHP, we have to connect with ADO, which is very similar to the connection database in ASP. Below gives a demo for everyone to refer to.
?
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21st 22 |
/* Create an ADO connection */ $conn = @new COM ("ADODB. Connection ") or Die (" ADO Connection faild. "); $connstr = "Driver={microsoft Access DRIVER (*.mdb)}; Dbq= ". Realpath ("Datum/cnbt.mdb"); $conn->open ($CONNSTR); /* Create a recordset query */ $rs = @new COM ("ADODB. RecordSet "); $rs->open ("SELECT * from Dbo_dirs", $conn, 1, 3); /* Looping through data */ while (! $rs->eof) { echo "$rs->fields[" title "]->value; echo " "; $rs->movenext (); Move the recordset pointer down } $rs->close (); ?> |
It's no problem running like this.
The above mentioned is the whole content of this article, I hope you can like.
http://www.bkjia.com/PHPjc/975133.html www.bkjia.com true http://www.bkjia.com/PHPjc/975133.html techarticle PHP Connection to Access database This article is about the use of ADO in PHP to link Access database methods, a very simple use, recommended for the needs of small partners to refer to the following ...