Jump to content

Archived

This topic is now archived and is closed to further replies.

joecooper

Alternating table colours

Recommended Posts

I have a simple "while" loop that creates a table. but for appearance, i would like it to alternate in colours, as in 2 types of gray background or something.

Share this post


Link to post
Share on other sites
Check for odd/even row numbers

[code]$count = 0;

while (.....) {


          $bg = ($count++ % 2) ? '#EEEEEE' : '#CCCCCC';

          echo "<TR style='background-color: $bg'>\n";

                # cell data here

          echo "</TR>\n";
}[/code]

Share this post


Link to post
Share on other sites
Might look here...

[a href=\"http://www.phpfreaks.com/tutorials/5/0.php\" target=\"_blank\"]http://www.phpfreaks.com/tutorials/5/0.php[/a]

Lite..

oops! too slow again.

Share this post


Link to post
Share on other sites
thanks! for the help, as im doing this whole project and have no time to test, i will let you know if it went well! thanks

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.