Re: Table Making

From: Date: Thu, 11 Jul 2002 17:05:17 +0000
Subject: Re: Table Making
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-107184@lists.php.net to get a copy of this message
> be, but in my head it seems like it would work. Basically, what if the > while() printed multiple tables? In each table it made 5 rows, each row > with one cell in it, so it would then be vertical. I'm just not sure > how to incorporate into the loop (maybe a for() loop is better for > this?) incremental queries, so that the first loop pulls rows 1-5, the Basically, you'd need an inner and outer loop. Something like this should work (untested): $result = mysql( $dbname, $query ); $numRows = mysql_num_rows( $result ); echo "<table>\n"; for( $i = 0; $i < $numRows; $i++ ) { echo "<tr><td>\n"; echo "<table>\n"; while( $dataArray = mysql_fetch_assoc( $result )) { echo "<td>" . implode( "</td></tr><tr><td>", $dataArray ) . "</td></tr> } echo "</table>\n"; echo "</td></tr>\n"; } echo "</table>\n"; You may need to fool around with it abit, but that should work... Chris

« previous php.general (#107184) next »