开发者

PHP to SQL Server without ODBC or MSSQL support

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 c开发者_如何转开发hange 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?


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(); 
} 
?> 
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜