不支持ODBC或MSSQL的PHP​​到SQL Server [英] PHP to SQL Server without ODBC or MSSQL support

查看:114
本文介绍了不支持ODBC或MSSQL的PHP​​到SQL Server的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的Windows主机具有PHP支持,但未将PHP配置为支持ODBC或MSSQL.我无法让他们改变这一点,所以我想知道是否存在一种通过其他方式连接到SQL Server的方法-也许包括一些提供我所需功能的文件?

I'm in a situation where my Windows hosting has PHP support, but the PHP is not configured to support ODBC or MSSQL. I can't get them to change that, so I'm wondering if there's a way to connect to SQL Server through other means - maybe including some files that provide the functions that I'd need?

推荐答案

找到了解决方案:

http://www.php.net/manual/zh/ref.mssql.php#42696

将其保留在此处,希望它可以使其他人更容易解决这种限制.

Leaving it up here in the hopes that it will make it easier for other people to get around this type of limitation.

为了完整起见,在此处复制

Copied here for completeness:

<?php 
$db = new COM("ADODB.Connection"); 
$dsn = "DRIVER={SQL Server}; SERVER={SERVER};UID={USER};PWD={PASS}; DATABASE={DB}";
 $db->Open($dsn); 
$rs = $db->Execute("SELECT * FROM table"); 

while (!$rs->EOF) 
{ 
    echo $rs->Fields['column']->Value."<BR>"; 
    $rs->MoveNext(); 
} 
?> 

这篇关于不支持ODBC或MSSQL的PHP​​到SQL Server的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆