Home  >  Article  >  Backend Development  >  mssql_connect()连接数据库的有关问题

mssql_connect()连接数据库的有关问题

WBOY
WBOYOriginal
2016-06-13 13:26:45935browse

mssql_connect()连接数据库的问题
mssql_connect($serverIP,$username,$password) or die("couldn't connect the server")

我用上面那个语句连接sql server数据库,为什么$severIP用计算机名称可以连接上,但是用localhost和127.0.0.1都连接不上?

我还想用这个函数连接远程服务器的数据库?怎么实现呢,直接填写IP地址连本地都连接不上,更不要说远程的了,请问大侠们问题出现在哪呢?


------解决方案--------------------
$serverIP是什么?

是不是mysql跑在其他端口上, 看看$serverIP是不是带有:port。
------解决方案--------------------
sql server 是这样的。写机器名更容易识别。你可以写上端口。
参考:http://php.net/manual/en/function.mssql-connect.php

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