Home > Backend Development > PHP Tutorial > How to use ODBC to connect PHP to the database under NT IIS

How to use ODBC to connect PHP to the database under NT IIS

WBOY
Release: 2016-08-08 09:33:48
Original
1006 people have browsed it

$connection = int odbc_connect(string dsn, string user, string passWord) establishes 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.

Then use while (odbc_fetch_row($cur)){
$var1=odbc_result($cur,1);
$var2=odbc_result($cur,1);
...
}
Read the data set $cur returned by odbc_exec().

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

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


The above introduces how PHP uses ODBC to connect to the database under NT IIS, including the content of ODBC connection to the database. I hope it will be helpful to friends who are interested in PHP tutorials.

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template