Re: Alternate row colours - what is wrong with this code?

From: Date: Fri, 17 Jan 2003 12:21:26 +0000
Subject: Re: Alternate row colours - what is wrong with this code?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-131989@lists.php.net to get a copy of this message
On Friday 17 January 2003 20:11, Denis L. Menezes wrote: > Hello Guys, > > I want alternating colours in the output table. Can someone tell me what is > wrong with this code? I get the data but no alternating colours. > > Quote : > > <?php > $cols = array('#ff0000','#00ff00'); > $i = 0; > while($row=mysql_fetch_array($result)){ > echo '<tr bgcolor="'.$cols[$i++%2].'">'; Look at the HTML source of the resulting page, if each <tr bgcolor...> is alternating then your code is working. Which means your HTML is dodgy ... > Print "<td width=\"12%\" align=\"center\" > height=\"6\" > bgcolor=\"#FFFFbf\"><font face=\"Tahoma\" > color=\"#000000\">" ; Print -- Jason Wong -> Gremlins Associates -> www.gremlins.biz Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development * /* There are no winners in life, only survivors. */

« previous php.general (#131989) next »