Modulus Formatting

From: Date: Tue, 06 Feb 2001 06:33:59 +0000
Subject: Modulus Formatting
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-38362@lists.php.net to get a copy of this message
> I can pull data out of a database using mysql_fetch_array and assemble it like this using a while statement: > > <TR><TD>$data</TD></TR> > <TR><TD>$data</TD></TR> > <TR><TD>$data</TD></TR> > etc ... > > What I'd like to do is assemble it like this: > > > <TR><TD>$data</TD><TD>$data</TD><TD>$data</TD></TR> > etc... > > In other words, I need a break (</TR><TR>) every three times through the > loop. > > I've tried several snippets of code from this list's archive but none seem > to work. I've tried while statements, for statements and the list function > in every combination I can think of ... no go. I know that modulus is what I need but I can't crack the right code combination. > > Does anyone have a solution or can they point me to a resource somewhere? > > > Thanks > > Mick > >

« previous php.general (#38362) next »