What I'd like is a quick way to display the data as an HTML table, without having to do all of the coding involved.
You are at the feedback permalink page for: More on displaying table data
What I'd like is a quick way to display the data as an HTML table, without having to do all of the coding involved.
You are at the feedback permalink page for: More on displaying table data
# (1 of 1): Tim » veryraw.com
2 hours, 8 minutes after the fact. (Thu 30 Nov 2006, 5:29 PM CST)
How about something like this. I thought about making a class to do it but I can't give you everything.
<?php $query = mysql_query("SELECT * FROM table"); if ( mysql_num_rows($run_actual_search) > 0 ) { $num_fields = mysql_num_fields($run_actual_search); // give field names echo "<table>\r<tr>\r"; for ($i=0; $i < $num_fields; $i ) { print "\t<th scope=\"col\">" . mysql_field_name($run_actual_search, $i). "</th>\r"; } echo "</tr>\r"; while ( $r = mysql_fetch_row($query) ) { echo "<tr>\r"; for ($f = 0; $f < $num_fields; $f ) { print "\t<td>".$r[$f]."</td>\r"; } echo "</tr>\r"; } echo "</table>\r"; } ?>