Re: table formatting
| From: | Matt McClanahan | Date: | Tue, 22 Aug 2000 23:22:44 +0000 |
| Subject: | Re: table formatting | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-13236@lists.php.net to get a copy of this message | ||
On Tue, 22 Aug 2000, Kevin Lincicome wrote:
> Is it possible to format a MySQL result table so that all fields are not on
> a single line? For example each record with 4 fields in the query result
> would be returned as such; |____field 1_______|_____field 2______|
> |_____field 3______|
> |_____field 4______|
> |next record...|
Sure, just keep track of what field you're on.
while( $row = mysql_fetch_row($res) )
{
echo '<tr>';
for( $i = 0; $i < 4; $i++ )
{
if( $i > 1 )
echo '</tr><tr>';
echo '<td>' . $row[$i] . '</td>';
}
echo '</tr>';
}
Or something like that.
Matt