【问题标题】:Having some trouble php connection string to a mssql server到 mssql 服务器的 php 连接字符串有一些问题
【发布时间】:2013-11-07 02:02:05
【问题描述】:

我一直在玩使用 MSSQL 的游戏,但我一直遇到连接问题,因为它一直以 undefined 的形式返回。

我对 PHP 了解不多,一个朋友帮我设置了服务器。 它是 Apache 2.2

$serveruser ="user";
$serverPass = "pass";
$server = "server";

$con = mssql_connect($server, $serveruser, $serverPass);

if (!$con)
    die('Could not connect:');

【问题讨论】:

  • 您收到什么错误信息?您确定凭据正确吗?请发布更多信息。

标签: php sql-server sql-server-2008


【解决方案1】:
$host="localhost";
$username="root";
$password="";
$dbhandle = mysql_connect($host, $username, $password);
$selected = mysql_select_db("database name",$dbhandle);
if($selected){
    echo "buuraaaa.....my database is selected \o/";
}
else    {
  echo "ohh,,,no its not selected";
}

【讨论】:

    【解决方案2】:

    连接的基本语法是:-

     mssql_connect("localhost<host name>", "<username>", "<password>");
    

    检查您的主机名、用户名和密码。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2015-11-19
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-06-28
      • 2014-04-10
      相关资源
      最近更新 更多