Alternate row colors programming in php
Alternating colors in php, it's simple. Here is the code:
foreach( $array_values as $value )
{
$counter++;
$background_color = ( $counter % 2 == 0 ) ? ('blue') : ('red');echo '' . $value . '';
}
As you can see it's simple. If the current row number is even the color is blue, if the row number is odd, background color is red. This is just an example, you can alternate what colors you want using php. $array_values array can be an array coming from a database query.
http://php-mysql-articles.blogspot.com/2007/11/how-to-alternate-row-colors-with-php.html