Table help

From: Date: Tue, 02 May 2000 13:08:32 +0000
Subject: Table help
Groups: php.dev 
Request: Send a blank email to php-dev+get-18348@lists.php.net to get a copy of this message
I have the following piece of code (not my own work!) that creates a table from records in a database. The first row shows field names (excluding the last 6), subsequent rows the records concerned. I would like to have the field names repeated above every row of records to make viewing easier but have been unable to get it to work. Can anyone suggest how to improve the code to allow this. Thanks. echo "<P><TABLE BORDER='1' CELLPADDING='2' CELLSPACING='2'><TR>"; for ($i=0; $i<mysql_num_fields($result)-6; $i++) { $field = mysql_fetch_field($result); echo "<B><TH align='left' bgcolor='#001090'><FONT face='Verdana' size='1' color='white'></B>"; echo "$field->name"; echo "</FONT></TH>"; } while ($row = mysql_fetch_row($result)) { echo "<TR>"; for ($i=0; $i<mysql_num_fields($result)-6; $i++) { echo "<TD valign='top'>"; ECHO "<FONT face='Verdana' size='1'>"; echo "$row[$i]"; echo "</FONT></TD>"; } } echo "</TABLE>"; Best regards Mick Lloyd mjl@consultingrooms.com www.consultingrooms.com Tel/Fax: +44 (0) 1684 560224

« previous php.dev (#18348) next »