Re: Displaying Records
| From: | James Atkinson | Date: | Mon, 21 Aug 2000 17:17:02 +0000 |
| Subject: | Re: Displaying Records | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-12770@lists.php.net to get a copy of this message | ||
On Mon, 21 Aug 2000, Phillip S. Baker wrote:
> Greetings All,
>
> 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.
>
> Thanks
>
> --
>
> Phillip S. Baker
Easy, just keep a counter var. ($count or something) and do something like this
do {
echo "<TD>$row[data]</TD>";
if(!($count % 3))
echo "</TR><TR>";
} while($row = mysql_fetch_array($dbConn));
Easy as pie, when $count is mod-ed if its divisable by 3 it returns 0 therefor
a new row is started.
--
James Atkinson
-----------------------------------------------------------------
James Atkinson 100world
Technical Developer 512-1529 West 6th Avenue
phone: +1-604-266-4490 ext.149 Vancouver, BC, V6J 1R1
fax: +1-604-742-1770 Canada
email: james.atkinson@100world.com http://www.100world.com
+---------------------------------------------------------------+
| This message may contain confidential and/or privileged |
| information. If you are not the addressee or authorized to |
| receive this for the addressee, you must not use, copy, |
| discolse or take any action based on this message or any |
| information herein. If you have received this message in |
| error, please advise the sender immediately by reply e-mail |
| and delete this message. Thank you for you cooperation |
+---------------------------------------------------------------+