[PHP] Re: Anyway of knowing whether a integer is odd or even From: _lallous (elias_bachaalany <email protected>)
Date: 10/09/01

sometimes you don't want to know whether odd or even to do what you're
asking for, therefore, consider the XOR example:

$colors = array("red", "green");
$start = 0;
while ($row = mysql_fetch_array($result))
{
  echo "<td bgcolor='{$colors[$start]}'>{$row[firstnamename]}</td>";
  $start ^= 1; // 1 xor 1 = 0, 0 xor 1 = 1, etc....
}
etc.....
"Sam" <Sam <email protected>> wrote in message
news:478EB6C82CC2D4119AF300B0D07963F4115C85 <email protected>
> 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.
>

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: php-general-unsubscribe <email protected>
For additional commands, e-mail: php-general-help <email protected>
To contact the list administrators, e-mail: php-list-admin <email protected>