Re: Anyway of knowing whether a integer is odd or even

From: Date: Tue, 09 Oct 2001 13:41:01 +0000
Subject: Re: Anyway of knowing whether a integer is odd or even
Groups: php.general 
Request: Send a blank email to php-general+get-70465@lists.php.net to get a copy of this message
> 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? do <? $color = "red"; for ($i = 0; $i < count($result_table); $i++ ) { echo "<TR BGCOLOR=$color><TD>" . $result_table[$i]["column"] . "</TD></TR>"; if ($color=="red") { $color = "blue"; } else { $color = "red"; } } ?>

« previous php.general (#70465) next »