Re: change color
| From: | Justin French | Date: | Tue, 27 May 2003 02:24:45 +0000 |
| Subject: | Re: change color | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-149046@lists.php.net to get a copy of this message | ||
<table>
<?
for($i=0;$i<10;$i++)
{
$bgcol = (($i % 2) == 0) ? "CCCCCC": "EEEEEE";
echo "<tr bgcolor='#{$bgcol}'><td>something
{$i}</td></tr>";
}
?>
</table>
Justin
on 27/05/03 2:01 PM, Tom Ray [Lists] (lists@blazestudios.com) wrote:
> This was a question I've been kicking around myself. But Evan's answer
> is a bit confusing to me, can someone clear it up? Evan, can you explain
> it a bit better? Maybe show how it is supposed to look in the overall code?
>
> Thanks!
>
> Evan Nemerson wrote:
>
>> echo (($i % 2) == 0) ? "Color 1": "Color 2";
>>
>>
>> On Monday 26 May 2003 07:29 pm, Aris Santillan wrote:
>>
>>
>>> hi
>>>
>>> how can i alternate row color for this routine?
>>>
>>> <?
>>>
>>> $query = mysql_query("SELECT * from data");
>>> $num = mysql_num_rows($query);
>>> for($i=0; $i<=$num; $i++)
>>> {
>>> $row = mysql_fetch_array($query);
>>> echo $row[0];
>>> }
>>>
>>>
>>> ?>
>>>
>>>
>>
>>
>>
>