简体   繁体   English

php到mssql服务器的PHP连接字符串出现问题

[英]Having some trouble php connection string to a mssql server

I been working game that use MSSQL but I have been having trouble with the connection as it keep coming back as undefined . 我一直在使用MSSQL进行游戏,但是由于连接一直undefined ,连接一直遇到问题。

I don't know much about PHP and a friend helped me setup the server. 我对PHP不太了解,一个朋友帮助我安装了服务器。 It's Apache 2.2 是Apache 2.2

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

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

if (!$con)
    die('Could not connect:');
$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";
}

The basic syntax of connection is :- 连接的基本语法是:

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

check your hostname, username and password. 检查您的主机名,用户名和密码。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM