I am attempting to pring out my dba so that its view able in rows and colmuns. With the first row consisting of the field name. I want all the contents of the table to be echo out and was thinking of writing a loop to do this until the table is all printed but i am not sure on how to write this. Does anyone have suggestions or know of a place that I can go to for an example.
I have added my code below. Thank you to anyone that can help.
<?php
$link = mysql_connect('localhost', 'uid', 'pw');
if (!$link) {
die('Not connected : ' . mysql_error());
}
// make foo the current db
$db_selected = mysql_select_db('nathanm_nuke1', $link);
if (!$db_selected) {
die ('Can\'t select db : ' . mysql_error());
}
?>
<html>
<head>
<title>updateResults.php</title>
</head>
<body>
<?php
$sql = "SELECT * FROM 2004Results WHERE 1";
$result = mysql_query($sql);
if (!$result) {
echo "Could not successfully run query ($sql) from DB: " . mysql_error();
exit;
}
echo "<table border=1>\n";
echo '<tr><th bgcolor="#CCCCFF">Bib</th>
<th bgcolor="#CCCCFF">FirstName</th>
<th bgcolor="#CCCCFF">LastName</th>
<th bgcolor="#CCCCFF">Address</th>
<th bgcolor="#CCCCFF">City</th>
<th bgcolor="#CCCCFF">State</th>
<th bgcolor="#CCCCFF">Zip</th>
<tr>';
echo '</table>';
?>
</table>
</body>
</html>
<?php
mysql_free_result($results);
?>