Home >Backend Development >PHP Tutorial >php连接mssql的有关问题 Warning: mssql_connect() [function.mssql-connect]

php连接mssql的有关问题 Warning: mssql_connect() [function.mssql-connect]

WBOY
WBOYOriginal
2016-06-13 10:09:46769browse

php连接mssql的问题 Warning: mssql_connect() [function.mssql-connect]:
我在IIS下面配置好了PHP5 
但是总是出现连接不上Mssql的提示。 
我的测试程序如下: 

$con=mssql_connect( "localhost", "sa ", "123456 ") or die ('error'); 
 
?> 

错误提示
 Warning: mssql_connect() [function.mssql-connect]: Unable to connect to server: $sa in D:\php\2.php on line 11
error

怎么回事啊 ! 网上的方法我都用啦!php也配置好啦,分号也去掉啦,两个文件也放到system32下啦!
急用! 谢谢啦!

------解决方案--------------------
"sa ", "123456 "

空格去掉试试,,不对,打印出错误号看看
------解决方案--------------------
,连不上的时候mssql_get_last_message(),应该有信息吧
------解决方案--------------------
不懂,但是把没用的空格去掉试试吧,你sa后面有空格,123456后面也有,localhost前面的"前面也有,去掉了试试吧

PHP code
$con=mssql_connect("localhost", "sa", "123456") or die ('error');<br><font color="#e78608">------解决方案--------------------</font><br>你配置好以后,运行phpinfo();如果里面有MSSQL的话,你得要安装sql数据库到你的电脑上面然后启动sql管理器在试试可能链接上;<br>如果还是没有连接上,我给你一个我自己的链接mssql的php类库给你使用http://download.csdn.net/source/2691449<br><font color="#e78608">------解决方案--------------------</font><br>把解决方案帖出来啊,我也是这问题<br><font color="#e78608">------解决方案--------------------</font><br>应该是SQL server配置有问题<div class="clear">
                 
              
              
        
            </div>
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