title: Update PHP class from mssql_ to sqlsrv_
body: <p>We've just updated PHP on our server, for the most part everything is fine, but the mssql_ functions aren't supported any more unfortunately. I've tried to update our previous class:</p>
  
  <pre><code>$connection['server'] = 'server, port';
  $connection['user'] = 'user';
  $connection['pass'] = 'pass';
  $connection['db'] = 'db';
  
  class mssqlClass {
      function connect($dbhost = NULL){
          global $connection;
          if(! ISSET ($dbconnect)){
              $dbconnect = mssql_Connect($connection['server'], $connection['user'], $connection['pass'], true);
          }
          if(! $dbconnect){
              return 'Failed to Connect to Host';
          }else{
              $select = mssql_select_db($connection['db'], $dbconnect);
              if(! $select){
                  return 'Failed to select Database';
              }else{
                  return $dbconnect;
              }
          }
      }
  
      function getData ($query){
          $this-&gt;data_array = array();
          $result = mssql_query($query);
          while ($row = mssql_fetch_assoc($result)) {
                      $this-&gt;data_array[] = $row;                                                    
          }
          $m = $this-&gt;data_array;                     
          return $m;
      }    
      function query($query){           
          $result = mssql_query($query) or die("Query didn't work");
      }
  }
  </code></pre>
  
  <p>To be compliant with sqlsrv_, and whilst I can connect to the database without any issues, it won't return any data!:</p>
  
  <pre><code>class mssqlClass {
      function connect($database = 'Db') {
          $mssql_server = 'server';
          $mssql_data = array("UID" =&gt; 'uid',
                          "PWD" =&gt; 'pwd',
                          "Database" =&gt; $database);
          if(! ISSET ($dbconnect)){
              $dbconnect = sqlsrv_connect($mssql_server, $mssql_data);
          }
          if(! $dbconnect){
              return 'Failed to connect to host';
          }
      }
  
      function getData ($query) {
          $result = sqlsrv_query($db-&gt;connect, $query);
          while ($row =  sqlsrv_fetch_array($result)) {
  
                      $this-&gt;data_array[] = $row;                                                    
          }
          $m = $this-&gt;data_array;                     
          return $m;
      } 
      function query($query) {           
          $result = sqlsrv_query($query) or die("Query didn't work.");
      }
  }
  </code></pre>
  
  <p>ps. Example usage is as follows:</p>
  
  <pre><code>$db = new mssqlClass();
  $conn = $db-&gt;connect('DATABASE');
  
  $query = "SELECT * FROM Table";
  $result= $db-&gt;getData($query);
  </code></pre>
  
  <p>So sorry for the horrible amount of code - I can edit it down to just the getData function if that's easier? Thank you!!</p>