After reading the article "how to call the Asscess database and COM program through ADO in PHP", I immediately did the test and the result failed. Sad.
What should I do? I had to go to the official PHP website for help, and Huang Tianyan had no worries, and finally I found the answer --
The specific solution is as follows:
(1) enter the category (Great, all class databases can handle it ).
(2) unpackage, there are many files in it, but only ohtml is useful. inc. php and adodb. inc. php, copy them to the corresponding directory (or c: php4peer under the default directory where php4 is installed, or if the program directory is run before, it depends on the include () function );
(3) then, in the c: myphp directory of the Local Chicken (one incorrect word, It is a machine) (iis is set to access through http: // localhost/jhk ), created a file named test. create an experts table in the access database of mdb ....... In order to ACCESS through DSN, I named the ACCESS library test in DSN.
(4) run. Looking at the instruction book, I made such a program:
Dbtest. php:
Include ('tohtml. inc. php'); // load code common to ADODB
Include ('ADODB. inc. php'); // load code common to adodb
$ Conn = & ADONewConnection ('access'); // create a connection
$ Conn-> PConnect ('test'); // connect to MySQL, agora db
$ SQL = 'select name, group1 from experts ';
$ Rs = $ conn-> Execute ($ SQL );
Rs2html ($ rs, 'border = 2 cellpadding = 3', array ('customer name', 'customer id '));
$ Rs-> Close (); // optional
$ Conn-> Close (); // optional
?>
Then, enter http: // localhost/jhk/dbtest. php in IE.
Alas! The result is displayed.
Satisfying !!
(5) Next, I thought: It's annoying to set up a DSN! How should I solve the problem of bypassing DSN? Because in asp, I used to use conn. open ("provider = Microsoft. jet. OLEDB.4.0; Data Source = "& Server. mappath (".. /nydatabase. mdb ") to process the mdb database. That's fast!
?...... I thought and thought, and read again .......
Search ,......, Hey, I finally found the answer in testdatabases. inc. php! Then I adapted the program:
Include ('tohtml. inc. php'); // load code common to ADODB
Include ('ADODB. inc. php'); // load code common to adodb
$ Db = & ADONewConnection ("ado_access ");
Print"