I am using the current code in attempt to access a msSQL 2005 db:
stop using
mssql_connect
and start using
sqlsrv_connect
That will save you a lot of headaches. Plus, the function *mssql_connect* has been deprecated.
For using sqlsrv_connect, you must download the driver and install it as an extension for PHP to recognize the sqlsrv functions. Download the driver from Microsoft Download Center (search for "sql server php driver"), at the time of this post the download url was: http://www.microsoft.com/en-us/download/details.aspx?id=20098
The right steps for installation are clearly explained by Microsoft itself at http://www.microsoft.com/en-us/download/details.aspx?id=20098
After installing the sql server driver, then simply follow the instructions from http://www.php.net/manual/en/function.sqlsrv-connect.php. Below a quick snippet:
"dbName");
$conn = sqlsrv_connect( $serverName, $connectionInfo);
if( $conn ) {
echo "Connection established.
";
}else{
echo "Connection could not be established.
";
die( print_r( sqlsrv_errors(), true));
}
?>
Vote up!