How to connect SQLServer2005 with PHP, phpsqlserver2005
1. Modify php.ini and delete the comment of extension=php_mssql.dll and save .
Modify php.in to change mssql.secure_connection = Off to mssql.secure_connection = On.
![](http://www.bkjia.com/uploads/allimg/150128/00531U3N-0.png)
2. Download ntwdblib.dll (2000.80.194.0) for 2005
Click to download
3. Open the file X:AppServphp5ext and copy php_mssql.dll to the system32 directory.
Copy the downloaded ntwdblib.dll to the system32 directory.
Copy the downloaded ntwdblib.dll to the php5 directory.
![](http://www.bkjia.com/uploads/allimg/150128/00531SH1-1.png)
Restart apache service
Connect MS SQL Server 2005 code
Copy code The code is as follows:
$conn=mssql_connect('59.173.xxxxxx.xxxxxx,1468','sa','xxxxxx');
mssql_select_db('HR',$conn);
$Query="select * from Class";
$Result=mssql_query($Query);
$Number=mssql_num_rows($Result);
for($i=0;$i<$Number;$i++)
{
$Row=mssql_fetch_array($Result);
echo($Row[1]);
echo("
");
}
?>
Look, are you connected to sql2005? I hope you guys like it.
http://www.bkjia.com/PHPjc/948408.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/948408.htmlTechArticleHow to connect PHP to SQLServer2005, phpsqlserver2005 1. Modify php.ini and delete the comment extension=php_mssql.dll and save it. Modify php.in to change mssql.secure_connection = Off to mssql.secure...