PHP Connection operation Access DB instance
This article mainly introduces the PHP connection operation Access database instance, this article directly gives the implementation code, the need for friends can refer to the following
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.
/*
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/976544.html www.bkjia.com true http://www.bkjia.com/PHPjc/976544.html techarticle PHP Connection Operation Access DB instance this article mainly introduces the PHP connection operation Access database instance, this article gives the implementation code directly, the need for friends can refer to the following because ...