Re: Displaying Records

From: Date: Mon, 21 Aug 2000 18:39:03 +0000
Subject: Re: Displaying Records
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-12780@lists.php.net to get a copy of this message
> I am pulling records for a MySQl database. > Simply displaying them using a Do while statement. > > However what I would like to to display three records horizontally in > a table then drop down to a new table row and display the next three > records, etc until all the records are displayed. > > How do I do this. i'd do this like: $n=1; while ($row = mysql_fetch_row($result) { if ($n==1) echo "<tr>"; echo "<td>$row[0]</td>; if ($n==3) { echo "</tr>"; $n=1; } $n++; } I'm sure there is a more elgant solution, but that's just the simplest that comes up to me... ~Peter 'the Keeper' http://www.thekeeper.com.ru tatisch at iname dot com

« previous php.general (#12780) next »