The following code is used to operate the ACCESS database: require_onceadodbadodb.inc.php; $ connNewADOConnection (access); $ connstrDriver {MicrosoftAccessDriver (*. mdb)}; DBQ. realpath (databasetestDB. mdb ).; uid; Pwd; $ conn-Conn
The following code is used to perform operations on the ACCESS Database: require_once 'ADODB/adodb. inc. php '; $ conn = NewADOConnection (access); $ connstr = Driver = {Microsoft Access Driver (*. mdb)}; DBQ =. realpath (database/testDB. mdb ).; uid =; Pwd =; $ conn-Conn
The following code is used to perform operations on the ACCESS database:
Require_once 'ADODB/adodb. inc. php ';
$ Conn = NewADOConnection ("access ");
$ Connstr = "Driver = {Microsoft Access Driver (*. mdb)}; DBQ = ". realpath ("database/testDB. mdb "). "; Uid =; Pwd = ;";
$ Conn-> Connect ($ connstr );
$ SQL = "select * from productClass ";
$ Rs = $ conn-> execute ($ SQL );
Print_r ($ rs-> GetRows ());
However, Chinese characters read from the database are garbled. The solution is to change the code to the following format:
Require_once 'ADODB/adodb. inc. php ';
$ Conn = new COM ("ADODB. Connection", NULL, 65001) or die ("ADO connect failed! ");
$ Connstr = "Driver = {Microsoft Access Driver (*. mdb)}; DBQ = ". realpath ("database/testDB. mdb "). "; Uid =; Pwd = ;";
$ Conn-> open ($ connstr );
$ SQL = "select * from productClass ";
$ RsArr = $ conn-> execute ($ SQL );
If ($ rsArr ){
While (! $ RsArr-> eof ){
Echo $ rsArr-> fields ["id"]. "". $ rsArr-> fields ["className"]."
";
$ RsArr-> MoveNext ();
}
} Else {
Print $ conn-> ErrorMsg ();
}
$ RsArr = null;
$ Conn-> close ();
$ Conn = null;