Home > Backend Development > PHP Tutorial > PHP连接SQLServer2005的方法_PHP

PHP连接SQLServer2005的方法_PHP

WBOY
Release: 2016-05-31 13:17:44
Original
1319 people have browsed it

1.修改php.ini将extension=php_mssql.dll的注释删除保存

修改php.in将mssql.secure_connection = Off改为mssql.secure_connection = On。

2.下载连接2005的ntwdblib.dll (2000.80.194.0)

点击下载

3. 打开文件X:\AppServ\php5\ext,把php_mssql.dll 复制到system32目录下。

把下载的ntwdblib.dll 复制到system32目录下。

把下载的ntwdblib.dll 复制到php5目录下。

重启apache服务

连接MS SQL Server 2005代码

代码如下:


 $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    {
 $Row=mssql_fetch_array($Result);
 echo($Row[1]);
 echo("
");
   }  
?>

看,是不是已经连接上了sql2005了呢,希望小伙伴们能够喜欢。

Related labels:
php
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template