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?
> 2) Grab more than one line from the database at a time, and just put in 
> two table rows at once?
> 
> Thanks for your help in advance!
> Glenn
> 
> 
> ---
> Glenn E. Sieb, System Administrator
> Lumeta Corp. mailto:[EMAIL PROTECTED]
> +1 732 357-3514 (V)
> +1 732 564-0731 (Fax)
> 

$color=($i%2) ? "grey" : "white; will let you change the background 
color depending on whether or not $i is even or odd.


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to