Home  >  Article  >  Backend Development  >  Using ODBC to connect to the database under NT IIS_PHP tutorial

Using ODBC to connect to the database under NT IIS_PHP tutorial

WBOY
WBOYOriginal
2016-07-21 16:03:22991browse

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

$query_string = "Conditions for querying records"
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.

Reuse 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.


www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/316264.htmlTechArticle$connection = int odbc_connect(string dsn, string user, string password) to establish a database connection, $query_string = query record Conditions such as: $query_string = select * from table use $...
Statement:
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