Up until yesterday I have been happily connecting to SQL Server Express 2005 using PHP 5 on IIS 7.
Yesterday I started getting errors when selecting a database.
<?php
$link = mssql_connect('localhost,1433', 'login', 'password');
if(!$link) {
die('could not connect to MSSQL');
}
if(!mssql_select_db('database', $link)) {
echo mssql_get_last_message();
die('could not select db');
}
?>
This outputs the following:
"Changed database context to 'database'.could not select db"
So mssql_get_last_message
is outputting Changed database context to 'database'.
which seems all correct and isn't really an error message. But then the mssql_select_db is still failing.
I have tested the following:
- The login is correct (you get a different error changing the username or password)
- The database exists (you get a different error if I use the name of a database that doesn't exist
- The login can connect to the database (you get a different error if you delete the database user in SQL Server)
I'm not sure what else to test.