SoFunction
Updated on 2025-04-08

NT IIS uses ODBC to connect to the database

$connection = int odbc_connect(string dsn, string user, string password) establish a database connection,

$query_string = "Query record condition"
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 the dataset $cur returned by odbc_exec().

Finally, odbc_close(int connection_id) closes the connection to the database.

The odbc_result() function takes the specified field value of the current record.