NT IIS下用ODBC连接数据库

2008-02-23 06:23:52来源:互联网 阅读 ()

新老客户大回馈,云服务器低至5折

$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()函数是取当前记录的指定字段值。


标签:

版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com
特别注意:本站所有转载文章言论不代表本站观点,本站所提供的摄影照片,插画,设计作品,如需使用,请与原作者联系,版权归原作者所有

上一篇:PHP中动态HTML的输出技术

下一篇:一个连接两个不同MYSQL数据库的PHP程序