Zebra-style Tables

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Post by RobertGonzalez »

Bear in mind that using Javascript to generate the Zebra table style will only work as long as the user has JS enabled.
User avatar
neel_basu
Forum Contributor
Posts: 454
Joined: Wed Dec 06, 2006 9:33 am
Location: Picnic Garden, Kolkata, India

Post by neel_basu »

neel_basu wrote:look at the 1st post of yours on this topic
Replace

Code: Select all

echo "\t\t<td>$col_value</td>\n";
Of That Post
With

Code: Select all

$clr[]="red";
$clr[]="green";
$num=0;
if($num==0)
  {
    echo "\t\t<td bgcolor=".$clr[0].">$col_value</td>\n";
    $num = 1;
  }
else
  {
    echo "\t\t<td bgcolor=".$clr[1].">$col_value</td>\n";
    $num = 0;
  }
Hello Did You Testd It? I Think It Would Work
Post Reply