<?php
// Send a select query to MSSQL
$query = mssql_query('SELECT [username] FROM [php].[dbo].[userlist]');
// Check if there were any records
if(!mssql_num_rows($query))
{
    echo 'No records found';
}
else
{
    for($i = 0; $i < mssql_num_rows($query); ++$i)
    {
        echo mssql_result($query, $i, 'username'), PHP_EOL;
    }
}
// Free the query result
mssql_free_result($query);
?>
     
    Результатом выполнения данного примера
будет что-то подобное: