Home > php教程 > php手册 > body text

NT IIS下用ODBC连接数据库_php基础

WBOY
Release: 2016-05-17 09:06:54
Original
1137 people have browsed it

$connection = int odbc_connect(string dsn, string user, string password)建立数据库连接,

$query_string = "查询记录的条件"
如:$query_string = "select * from table"

用$cur = int odbc_exec(int connection_id, string query_string)检索数据库,将记录集放入$cur变量中。

再用while (odbc_fetch_row($cur)){
$var1=odbc_result($cur,1);
$var2=odbc_result($cur,1);
...
}
读取odbc_exec()返回的数据集$cur。

最后是odbc_close(int connection_id)关闭数据库的连接。

odbc_result()函数是取当前记录的指定字段值。  

  

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 Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!