Re: Anyway of knowing whether a integer is odd or even
| From: | ReDucTor | Date: | Tue, 09 Oct 2001 13:40:15 +0000 |
| Subject: | Re: Anyway of knowing whether a integer is odd or even | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-70466@lists.php.net to get a copy of this message | ||
inside your loops just do something like this
echo "<table>\n";
$colorarry = array("red", "green", "blue", "pink");
foreach($blah as $field)
{
if(empty($tempnum)) $tempnum = 0;
$color = $colorarray[$tempnum];
if($tempnum != sizeof($colorarray))
$tempnum++;
else
$tempnum = 0;
echo "<tr><td bgcolor=$color>$field</td></tr>\n";
}
----- Original Message -----
From: "Sam" <Sam@dragoman.co.uk>
To: "'php'" <php-general@lists.php.net>
Sent: Tuesday, October 09, 2001 11:30 PM
Subject: [PHP] Anyway of knowing whether a integer is odd or even
> Hi all,
>
> I have a query which returns X amount of rows.
> I would like to display even rows one colour and odd rows a different
> colour.
> Is there a way to do this?
>
> Thanks in advance,
>
> Sam Rose
>
> p.s. Also I'm only on the digest, so if you could reply directly to me as
> well, that would be a bonus.
>