: This article mainly introduces how to use ODBC to connect to a database in PHP under NTIIS. if you are interested in the PHP Tutorial, refer to it. $ 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.
The above describes how to use ODBC to connect to the database in PHP under nt iis, including the content of ODBC to connect to the database, and hope to help friends who are interested in PHP tutorials.