Affichage MSSQL sélectionner les données en tableau php

Je suis absent quelque chose de simple, j'en suis sûr. C'est la première fois que je suis en tirant des données à partir d'un serveur MSSQL et les afficher dans une table à l'aide de php. Je l'ai fait dans le passé avec mysql, mais impossible de le faire fonctionner avec mssql. Voici mon code actuel:

<?php
 $myServer = "server";
 $myUser = "user";
 $myPass = "password";
 $myDB = "mssqldb"; 

 //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 col1, col2 ";
     $query .= "FROM sqltable ";

 //execute the SQL query and return records
     $result = mssql_query($query)
         or die('A error occured: ' . mysql_error());

 //Show results in table

 $o = '<table id="myTable">
         <thead>
         <tr>
         <th>Col 1</th>
         <th>Col 2</th>
         </tr>
         </thead><tbody>';

      while ( $record = mssql_fetch_array($result) )
          {
              $o .= '<tr><td>'.$col1.'</td><td>'.$col2.'</td></tr>';
          }               

       $o .= '</tbody></table>';

       echo $o;

    //Show result from sql table separated by comma (commented out)
       /* while ( $record = mssql_fetch_array($result) )
        {
            echo $record["col1"] . " , " . $record["col2"] . "<br />";
        } */

    //free result set memory
        mssql_free_result($result);

    //close the connection
        mssql_close($dbhandle);
    ?>

OriginalL'auteur klcant | 2011-12-30