PHP connection Operation access database instance, access instance _ PHP Tutorial

Source: Internet
Author: User
Tags mysql connect
PHP connects to access database instances and access instances. PHP connects to an access database instance. the access instance uses the structure of Delphi and access because the previous PingSwitch is used as a front-end for WEB display, while Delphi and MySQL connect to PHP to operate access database instances and access instances

Because the previous PingSwitch is used as a front-end for WEB display, the Delphi and access structures are used at the beginning, and the connection between Delphi and MySQL is relatively troublesome, at last, I can only choose a combination of PHP + Access, which is strange but reasonable ·····

To connect to the access database in PHP, we must connect to ADO, which is very similar to connecting to the database in ASP. A demo is provided below for your reference.

<? 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 record set query
*/
$ Rs = @ new COM ("ADODB. RecordSet ");
$ Rs-> Open ("select * from dbo_dirs", $ conn, 1, 3 );
/*
Read data cyclically
*/
While (! $ Rs-> eof ){
Echo "$ rs-> Fields [" title "]-> Value;
Echo"
";
$ Rs-> Movenext (); // move the record set pointer down
}
$ Rs-> close ();
?>

In this way, it will be okay ····
The above is all the content of this article. I hope you will like it.

Because the previous PingSwitch is used as a front-end for WEB display, the Delphi and access structures are used at the beginning, while the connection between Delphi and MySQL is...

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.