PHP Connection Operation Access DB instance, access instance
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.
<? Php
/*
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/976023.html www.bkjia.com true http://www.bkjia.com/PHPjc/976023.html techarticle PHP Connection Operation Access DB instance, access instance because the previous pingswitch to do a Web presentation of the front end, because the first use of the Delphi and Access structure, and Delphi and MySQL connected ...