I get the following error when trying to select a database with php's
standard mssql_select_db
function: USE statement is not supported to switch between databases. Use a new connection to connect to a different Database. (severity 16)
. So i'm stumped as in where to go from here.
Connection Code:
$link = mssql_connect('dsn', 'user@server', 'password');
if (!$link) {
die('Unable to connect!');
}
if (!mssql_select_db('db', $link)) {
die('Unable to select database!');
}
$result = mssql_query('SELECT * FROM yourtable');
while ($row = mssql_fetch_array($result)) {
var_dump($row);
}
My system setup is as follows:
- Ubuntu 12.10
- PHP5
- Apache2
- freeTDS
- unixODBC
- SQL Azure
Also I was following this guide.