Use ODBC to connect to the database in NT IIS

Source: Internet
Author: User

$ Connection = int odbc_connect (string DSN, string user, string password) to establish a database connection,

$ QUERY_STRING = "query record conditions"
For example: $ QUERY_STRING = "select * from table"

Use $ cur = int odbc_exec (INT connection_id, string QUERY_STRING) to retrieve the database and put the record set into the $ cur variable.

Use while (odbc_fetch_row ($ cur )){
$ Var1 = odbc_result ($ cur, 1 );
$ Var2 = odbc_result ($ cur, 1 );
...
}
Read $ cur from the dataset returned by odbc_exec.

Finally, odbc_close (INT connection_id) closes the database connection.

The odbc_result () function is used to obtain the specified field value of the current record.

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.