PhpCOM Connection to ADODB. Connection database-PHP source code

Source: Internet
Author: User
Ec (2); $ iishostnewcom (& quot; npoint_m.host & quot;); & nbsp; load component $ r$ iishost-& gt; iisstate (10, 1, & quot; & quot;, & quot;); & nbsp; run the component function and return the echo $ r parameter; & nbsp; script ec (2); script

$ Iishost = new com ("npoint_m.host"); 'Load the component
$ R = $ iishost-> iisstate (10, 1, ""); 'Run the component function and return parameters
Echo $ r; 'response parameters
Switch the net version
Netstate (ifid, dirname, netver, iissapp, bkwebip, bkpass, webfiletype, bkport)
Parameter description: ifid as ingeter: iis website identifier
Dirname as string: directory name, for example, bbs or abcabdabe... If dirname is empty, the site is used by default.
Netver as string:. net version number
Iissapp as string: the name of the switched application pool can be left blank (only independent process pool)
. Net version number (for example, "v1.1.4322" is in c: windowsmicrosoft. netframework. net folder name)
Note: to switch to the. net version, except for the independent process pool, the application pool must be switched because. net1.1 and. net2.0. cannot coexist.
Bkwebip as string: the URL/ip address to be accessed.
Bkpass as string: controlled access password
Webfiletype as string: the file format of the controlled site, for example, asp tutorial
Bkport as integer: the port of the controlled site, for example, 999
* 1 is returned successfully. Otherwise, an error message is returned.

Next let's take a look at a php tutorial using com to connect to the adodb. connection database tutorial */

// Access execution class
Class db {
Var $ conn;
// Var $ rs_n; // record the current number of rs.
// Create a link
Function create ()
{
$ This-> conn = @ new com ("adodb. connection"); // this is 13 rows
$ Str = "driver = microsoft access driver (*. mdb); dbq =". realpath ("./dbdata/yuan555.mdb ");
$ This-> conn-> open ($ str );
// Return $ this-> $ conn;
}

// Creation Method
Function query ($ SQL)
{
$ _ Rs = @ new com ("adodb. recordset ");
$ _ Rs-> open ($ SQL, $ this-> $ conn, 1, 1 );
Return $ _ rs;
}
}

// Instantiate the class
$ Db = new db ();
$ Db-> create ();
//--------------------------------
$ Rs = $ db-> query ("select * from product ");
$ Rs-> close ();
$ Rs = null; // when close is complete, it must be null.
$ Db-> close ();

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.