$color = "tan";
FOR ($i=0 ; $i < $numrows ; $i++) {
    if ( ($i % 2) == 0 ) {
      ECHO ("\n<TR>");
    } else {
      ECHO ("\n<TR BGCOLOR=$color>");
    }
}

> -----Original Message-----
> From: Rasmus Lerdorf [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, January 25, 2001 4:19 PM
> To: Mike
> Cc: [EMAIL PROTECTED]
> Subject: Re: [PHP] html table
> 
> 
> > How do I get every other column to be a different color (or 
> font ect.)when
> > I'm populating a table from a db(different field counts all the time)
> 
> If $i is a counter then $i%2 will alternate between 0 and 1
> 
> $i%3 would cycles through 0,1 and 2
> 
> -Rasmus
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
> 
> 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to