[SOLVED] PHP and MSSQL Connection
Posted: Thu Aug 04, 2005 12:41 pm
I've the following code below. It's running on Windows 2000 Web Server. Every time I run it, it gave me the error below. My DNS server name is "ga04", my windows password is "test", database name is "Student". Do I need to use "localhost" for the hostname? Could someone tells me why?
Warning: mssql_connect() [function.mssql-connect]: Unable to connect to server: ga04 in c:\Inetpub\wwwroot\schoolProject\TestConnect2.php on line 23 Unable to open database
$hostname = "ga04";
$username = "test";
$dbName = "Student";
$password = "Student";
mssql_connect($hostname,$username,$password) or DIE("Unable to open database");
mssql_select_db($dbName) or DIE("Unable to open table");
$query = "SELECT * from users";
$result = MSSQL_QUERY($query);
$nrow = MSSQL_NUM_ROWS($result);code.
Warning: mssql_connect() [function.mssql-connect]: Unable to connect to server: ga04 in c:\Inetpub\wwwroot\schoolProject\TestConnect2.php on line 23 Unable to open database
$hostname = "ga04";
$username = "test";
$dbName = "Student";
$password = "Student";
mssql_connect($hostname,$username,$password) or DIE("Unable to open database");
mssql_select_db($dbName) or DIE("Unable to open table");
$query = "SELECT * from users";
$result = MSSQL_QUERY($query);
$nrow = MSSQL_NUM_ROWS($result);code.