<?php // Connecting, selecting database $link = mysql_connect('localhost', '', '') or die('Could not connect: ' . mysql_error()); echo 'Connected successfully'; mysql_select_db('database') or die('Could not select database');
// Performing SQL query $query = 'SELECT * FROM tblusers WHERE squadnum <99'; $result = mysql_query($query) or die('Query failed: ' . mysql_error());
// Printing results in HTML
echo "<table border=1>\n";
while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) { echo "\t<tr>\n";
foreach ($row as $col_value) {
echo "\t\t<td>$col_value</td>\n";
}
echo "\t</tr>\n";
}
echo "</table>\n";
?>
Any help much appreciated, nick.
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php