title: Currently selected database in SQL Server
body: <p>I am currently tasked with porting our website code onto a linux server (from Win2003). The websites run on a SQL Server database. The original dev created a wrapper to contain all interaction with the database including selecting the correct database (the application spans multiple databases)
  The problem code is as follows...</p>
  
  <pre><code>if (strcmp($this-&gt;_DB_Connection, $param_Database) &lt;&gt; 0) {
    $this-&gt;_DB_Selected = @mssql_select_db($param_Database, $this-&gt;_DB_Connection);
  }
  </code></pre>
  
  <p>Where $this->_DB_Connection is the connection to the DB server and $param_Database is the name of the database required for the next query.</p>
  
  <p>The problem is that on Windows, strcmp returns <strong>1</strong>, on linux it returns <strong>NULL</strong>.</p>
  
  <p>Anyone have a work around for this that <em>doesn't</em> involve selecting the database each time.</p>