RE: [PHP] Making alternate rows of different colour

From: Date: Sat, 18 Jan 2003 01:24:21 +0000
Subject: RE: [PHP] Making alternate rows of different colour
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-132067@lists.php.net to get a copy of this message
<?php $bgcolor = ($i % 2 == 0) ? " BGCOLOR='#E3E3E3'" : ""; ?> <TR<?=$bgcolor?>> > > 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>'; > }

« previous php.general (#132067) next »