Home >Backend Development >PHP Tutorial >How to connect to SQLServer2005 with PHP, phpsqlserver2005_PHP tutorial

How to connect to SQLServer2005 with PHP, phpsqlserver2005_PHP tutorial

WBOY
WBOYOriginal
2016-07-13 10:08:51949browse

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.

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.

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.

www.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...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn