title: Fatal error: Call to undefined function mssql_fetch_array() in C:\xampp\htdocs\myFolder\exceltest.php on line 25
body: <p>I am trying to export data from MSSQL table to Excel. Below is my code.
  Problem is that i am getting the following error:</p>
  
  <pre><code>    Fatal error: Call to undefined function mssql_fetch_array() in C:xampp\code.php on line 25
  </code></pre>
  
  <p>I am running Windows Server 2008 R2, IIS7, SQL Server 2008, PHP Version 5.4.4.</p>
  
  <p>I have un-commented the line: "extension=php_mssql.dll" found in C:\xampp\php\php.ini</p>
  
  <pre><code>    &lt;?php
  // load library
  require 'include\php-excel.class.php';
  
  $i = 0; // used as a counter
  
  $myServer = "SERVERNAME\SQLEXPRESS";
  $myUser = "UserName";
  $myPass = "xxxxxx";
  $myDB = "dbName";
  
  $conn = new COM ("ADODB.Connection") or die("Cannot start ADO");
  
  $connStr = "PROVIDER=SQLOLEDB;SERVER=".$myServer.";UID=".$myUser.";PWD=".$myPass.";DATABASE=".$myDB;
  $conn-&gt;open($connStr); //Open the connection to the database
  
  $result = "SELECT Col1, Col2, Col3 FROM myTable WHERE Col3='myCondition'";
  
  //$rs = $conn-&gt;execute($result);
  //$num_columns = $rs-&gt;Fields-&gt;Count();
  
      // create data array and print headers on the first row
      $data = array(1 =&gt; array ('No.', 'Col1', 'Col2', 'Col3'));
  
      while($row=mssql_fetch_array($result)) {
  //include additional rows
  array_push($data, array($i, $row['Col1'], $row['Col2'], $row['Col3']));
  $i++;
  }
  
  // If no results, indicate this on the first row
  if ($i == 0){
  $data = array(1 =&gt; array ('No results', 'empty', 'empty', 'empty'));
                          }
  
  //generate file (constructor parameters are optional)
  $xls = new Excel_XML('UTF-8', false, 'My Test Sheet');
  $xls-&gt;addArray($data);
  $xls-&gt;generateXML('MyReport');
      ?&gt;
  </code></pre>
  
  <p>Thank you in advance.</p>