RE: [PHP] html table
| From: | Brian V Bonini | Date: | Thu, 25 Jan 2001 21:57:47 +0000 |
| Subject: | RE: [PHP] html table | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-36707@lists.php.net to get a copy of this message | ||
$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:rasmus@php.net]
> Sent: Thursday, January 25, 2001 4:19 PM
> To: Mike
> Cc: php-general@lists.php.net
> 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: php-general-unsubscribe@lists.php.net
> For additional commands, e-mail: php-general-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
>
>