欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  后端开发

NT IIS下用ODBC连接数据库_PHP教程

程序员文章站 2022-04-30 23:32:01
...
$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()函数是取当前记录的指定字段值。


www.bkjia.comtruehttp://www.bkjia.com/PHPjc/316264.htmlTechArticle$connection = int odbc_connect(string dsn, string user, string password)建立数据库连接, $query_string = 查询记录的条件 如:$query_string = select * from table 用$...