RE: [PHP] Two things

From: Date: Wed, 17 Jan 2001 20:17:03 +0000
Subject: RE: [PHP] Two things
Groups: php.general 
Request: Send a blank email to php-general+get-35130@lists.php.net to get a copy of this message
Did you mean this? <?php $i = 0 $colors = array('#ffffff','#00000'); ?> -Ben -----Original Message----- From: Rasmus Lerdorf [mailto:rasmus@php.net] Sent: Wednesday, January 17, 2001 11:52 AM To: Phil Labonte Cc: php-general@lists.php.net 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: php-general-unsubscribe@lists.php.net For additional commands, e-mail: php-general-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net

« previous php.general (#35130) next »