Jump to content

[SOLVED] switch row colors


asmith

Recommended Posts

i have some results from a table ,

i want to show them in html table tag .

each row of mysql table goes to each row of html table tag.

 

the question i've got is:

what s the simplest way to switch the background colors of html table rows,

you know for example odd rows goes white, even rows goes grey...

 

Link to comment
https://forums.phpfreaks.com/topic/79566-solved-switch-row-colors/
Share on other sites

this is how i did in using php

for ($i = 0; $i < $_POST['num_images']; $i++){
// Determine alternate row colours
if($i % 2 == 0){
$style = "bgcolor=\"#FFFFFF\"";
$bottomstyle = "bgcolor=\"#FFFFFF\"";
} else {
$style = "bgcolor=\"#EFEFEF\"";
$bottomstyle = "bgcolor=\"#EFEFEF\"";
}

Archived

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

×
×
  • Create New...

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.