<?php
$hostname = "myhostname";
$username = "myusername";
$password = "mypassword";
$dbname = "mydbname";
$sqlConn=@mssql_connect($hostname, $username, $password);
$query = "SELECT * FROM mytable ORDER BY fname";
$result = mysql_query($query) or die ("Query failed");
//number of rows in our result for loop
$numofrows = mysql_num_rows($result);
echo "\n";
echo "First NameLast NameE-mail\n";
for($i = 0; $i < $numofrows; $i++) {
$row = mysql_fetch_array($result); //get a row from result set
if($i % 2) { //if there is a remainder
echo "\n";
} else { //if there isn't a remainder
echo "\n";
}
echo "".$row['fname']."".$row['lname']."".$row['email']."\n";
echo "\n";
}
//now let's close the table and be done with it
echo "\n";
?>