Re: Making alternate rows of different colour

From: Date: Fri, 17 Jan 2003 08:05:11 +0000
Subject: Re: Making alternate rows of different colour
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-131976@lists.php.net to get a copy of this message
> I put the output of the database query in a table. It works fine. Now I have a need to make the > alternate rows of a different color. > > Can someone please help me with the code? $cols = array('#ff0000','#00ff00'); $i = 0; while(your_loop_to_output_each_row) { echo '<tr bgcolor="'.$cols[$i%2].'"><td>$row_data</td></tr>'; } -Rasmus

« previous php.general (#131976) next »