简体   繁体   中英

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 .

I don't know much about PHP and a friend helped me setup the server. It's 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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