Re: Two things
| From: | Rasmus Lerdorf | Date: | Wed, 17 Jan 2001 19:52:02 +0000 |
| Subject: | Re: Two things | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-35126@lists.php.net to get a copy of this message | ||
> 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