Re: Alternating table rows...

From: Date: Fri, 10 May 2002 18:47:44 +0000
Subject: Re: Alternating table rows...
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-96985@lists.php.net to get a copy of this message
On Saturday 11 May 2002 02:45, Glenn Sieb wrote: > Hi everyone, > > I have a PHP script that reads data from an MS SQL server and outputs the > data into a table. I've been asked if I can alternate the colors of the > rows to make the report more legible. The relevant piece of code looks > like: > > for ($i = 0; $i < mssql_num_rows( $stmt ); ++$i) > { > $line = mssql_fetch_row($stmt); > print ("<TR><FONT > > COLOR=#$color><TD>$line[2]</TD><TD>$line[0]</TD><TD>$line[3]</TD></TR>"); > } > > Is there a way for me to do one of the following: > > 1) Test to see if $i is an even or odd number? if ($i % 2) { odd; } else { even; } -- Jason Wong -> Gremlins Associates -> www.gremlins.com.hk Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development * /* "I once witnessed a long-winded, month-long flamewar over the use of mice vs. trackballs...It was very silly." (By Matt Welsh) */

« previous php.general (#96985) next »