Use PHP to configure and connect to the Access Database

Source: Internet
Author: User
Tags file info
First download php-5.1.1-installer.exe

More than 2 m, click it, and click OK. Run the command and go to disk D. click Next. Create a directory named PHP and create the file info. php and enter the code:

<HTML>
<Body>
<? Phpinfo ();?>
</Body>
<HTML>

Data in IIS: http: // localhost/PHP/info. php

If a long string of PHP version 5.1.1 appears, congratulations. The configuration is complete.

:

  

Create PHP/data/DB. mdb, create the table szd_t, and enter the data ,:

  

Create the file default. php. input:

<?
$ Conn = new COM ("ADODB. Connection ");
$ Connstr = "driver = {Microsoft Access Driver (*. mdb)}; DBQ =". realpath ("Data/DB. mdb ");
$ Conn-> open ($ connstr );
$ Rs = new COM ("ADODB. recordset ");
$ RS-> open ("select * From szd_t", $ Conn, 1, 1 );
While (! $ RS-> EOF ){
$ F = $ RS-> fields (1 );
Echo $ F-> value;
$ RS-> movenext ();
}
?>

Browse, and print the record you just logged in the database. It's successful. Hahaha, it's finished. :

  

 

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.