PHP Connection Operation Access DB Instance _php tutorial

Source: Internet
Author: User

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 ...

  • 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.