Hi,

Just make the modification listed below:

while ($row = mysql_fetch_row($result))
{
  $cell_color = ++$i % 2 ? "#C0C0C0" : "#CCCCCC";
  echo "<TR bgcolor=\"$cell_color\">\n";
  for ($i =1;$i<mysql_num_fields($result);$i++) {
    echo "<td>$row[$i]</td>";
  }
}

Mike P wrote:

> I can change the column sof a table with the following code but how do I
> change the row colors instead.With the columns I have "i" to manipulate but
> not with rows.
>
> while ($row = mysql_fetch_row($result))
> {{
>         echo "<TR>\n";
>         for ($i =1;$i<mysql_num_fields($result);$i++)
>                 {$cell_color = "#C0C0C0";
>         $i % 2  ? 0: $cell_color = "#CCCCCC";
>         echo "<td bgcolor=\"$cell_color\">$row[$i]</td>";
> Thanks
> Mike P
> [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]

--
Regards,
Harshdeep Singh Jawanda.



-- 
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]

Reply via email to