Re: Table Output Question

From: Date: Tue, 15 Nov 2005 00:21:35 +0000
Subject: Re: Table Output Question
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-40659@lists.php.net to get a copy of this message
You don't have to output two rows.. just do this: $color = "red"; // init first color. while ($row = mysql_fetch_assoc($data)) { if ($color == "red") { $color = "blue"; } else { $color = "red"; } ?> <tr bgcolor="<?=$color?>"><td>..................</td></tr> <? } -Micah On Monday 14 November 2005 3:37 pm, Jeff Grossman wrote: > I have a table, where each line is the output of a query from a MySQL > database. I do not use borders, so the page is a little difficult to > read sometimes. Is it possible, or how do I, alternate the background > color of each row when I output it? > > My code is like this: > > while (query) { > <TR> > <TD></TD> > </TR> > } > > I am not sure how to output two rows in the same while loop. > > Thanks for any help you can offer me.

« previous php.db (#40659) next »