Hi, I can't seem to nail down the simplest way to do this. I've got 10-15 lines of code right now to do something that should take less. The following code extracts the names of all the fields in a table, prints them across a table row in their own cells, and then extracts each record and prints a table row for each.
$result = mysql_query("SELECT * FROM meatmap"); echo "<table>\r\n"; echo "<tr>\r\n"; $row = mysql_fetch_assoc($result); foreach($row as $key => $value) {echo "<td>$key</td>\r\n"; } echo "</tr>\r\n"; mysql_data_seek($result, 0); while($row = mysql_fetch_assoc($result)) { echo "<tr>"; foreach($row as $key => $value) {echo "<td>$value</td>\r\n"; } echo "</tr>"; } echo "</table>\r\n"; I know there has to be an easier way, both concept and code wise, to do this. Any ideas out there? A message earlier this week gave me the general idea... the previous way I had been doing this was EVEN MORE ungainly. Thanks, db -- ---------- Dan Barton Terrestrial Program Biologist Asst. Data Manager Point Reyes Bird Observatory http://www.prbo.org [EMAIL PROTECTED] [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]