This blog site is not meant to be any information that is distributed to the general public. It is to serve as shared documentation between the DNSTC developers; however, if you find something useful and would like to use it, go right ahead.

Tuesday, April 16, 2013

Every Other Row a Different Color

construction-work-icon

The following code will allow you to change colors every other row in PHP.

Add the following around the do { loop:

$cnt = 0;
do {
$color = ($cnt & 1)? "#F8F8F8" : "#FFFFFF";
$cnt++;

.
.
.
Add the following to the <tr> tag:

<tr style="background-color: <?php echo $color; ?>">


 


With this example, every other row will be a light grey color and the other row will be white.  The first row starts off being white.

No comments:

Post a Comment