title: Unable to connect to msSQL database via PHP
body: <p>I am using the current code in attempt to access a msSQL 2005 db:</p>
  
  <pre><code>&lt;?php
  $myServer = "[server]";
  $myUser = "[username]";
  $myPass = "[password]";
  $myDB = "[db]";
  
  //connection to the database
  $dbhandle = mssql_connect($myServer, $myUser, $myPass)
    or die("Couldn't connect to SQL Server on $myServer");
  
  //select a database to work with
  $selected = mssql_select_db($myDB, $dbhandle)
    or die("Couldn't open database $myDB");
  
  //declare the SQL statement that will query the database
  $query = "SELECT id, name, year ";
  $query .= "FROM cars ";
  $query .= "WHERE name='BMW'";
  
  //execute the SQL query and return records
  $result = mssql_query($query);
  
  $numRows = mssql_num_rows($result);
  echo "&lt;h1&gt;" . $numRows . " Row" . ($numRows == 1 ? "" : "s") . " Returned &lt;/h1&gt;";
  
  //display the results
  while($row = mssql_fetch_array($result))
  {
    echo "&lt;li&gt;" . $row["id"] . $row["name"] . $row["year"] . "&lt;/li&gt;";
  }
  //close the connection
  mssql_close($dbhandle);
  ?&gt;
  </code></pre>
  
  <p>It is returning the following:</p>
  
  <pre><code>Warning: mssql_connect() [function.mssql-connect]: Unable to connect to server: XXXXXXX in D:\xxxxx.xxx\xxxx.php on line 16
  Couldn't connect to SQL Server on XXXXXXX
  </code></pre>
  
  <p>What do you think the problem is?</p>