Use ADO in PHP for Windows

Source: Internet
Author: User

In this example, a connection is established, and the Access Database NorthWind is opened with ODBC (the example is provided when Access is installed ). After the SQL statement is executed, the RecordSet object is returned. The example shows the first three fields:

<?
$ Dbc = new COM ("ADODB. Connection ");
$ Dbc-> Provider = "MSDASQL ";
$ Dbc-> Open ("nwind ");
$ Rs = $ dbc-> Execute ("select * from products ");
$ I = 0;
While (! $ Rs-> EOF ){
$ I + = 1;
$ Fld0 = $ rs-> Fields (0 );
$ Fld1 = $ rs-> Fields (1 );
$ Fld2 = $ rs-> Fields (2 );
Print "$ fld0-> value $ fld1-> value $ fld2-> value <BR> ";
$ Rs-> MoveNext ();
}
$ Rs-> 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.