Did you mean this?
<?php
$i = 0
$colors = array('#ffffff','#00000');
?>
-Ben
-----Original Message-----
From: Rasmus Lerdorf [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, January 17, 2001 11:52 AM
To: Phil Labonte
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP] Two things
> When I get a list of items from a database I would like to display them
with
> alternating colors. Does anyone know how or where I can get some code
that
> will show me how to do that?
$col = 0;
$colors = array('#ffffff','#000000');
while($row=mysql_fetchrow($result)) {
echo "<td bgcolor=".$colors[$i++%2].">".$row[0]."</td>\n";
}
> The other question is what is the code to get the ip of the client that is
> accessing your site? I know that one is easy but I forget how to do it.
$REMOTE_ADDR
-Rasmus
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]