RE: [PHP] Row colors
| From: | Maxim Maletsky | Date: | Mon, 09 Apr 2001 10:03:18 +0000 |
| Subject: | RE: [PHP] Row colors | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-47757@lists.php.net to get a copy of this message | ||
Here,
just was working on it:
<snip>
...
$bgcolor = (($row_count%2)==0) ? ' bgcolor="#DBDBDB"' : '';
$row_count++;
echo "<TR$bgcolor>";
...
</snip>
Cheers,
Maxim Maletsky
www.PHPBeginner.com
-----Original Message-----
From: Rikul [mailto:rikul@shreve.net]
Sent: Monday, April 09, 2001 6:30 PM
To: Harshdeep S Jawanda; Mike P
Cc: php-general@lists.php.net
Subject: Re: [PHP] Row colors
Something like this could work also:
<tr bgcolor="<? echo
$row_color=="#cccccc"?$row_color="#c0c0c0":$row_color="#cccccc"
?>"
----- Original Message -----
From: "Harshdeep S Jawanda" <harsh@pspl.co.in>
To: "Mike P" <mpeloso@princeton.edu>
Cc: <php-general@lists.php.net>
Sent: Monday, April 09, 2001 1:11 AM
Subject: Re: [PHP] Row colors
> 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
> > mpeloso@princeton.edu
> >
> > --
> > 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
>
> --
> Regards,
> Harshdeep Singh Jawanda.
>
>
>
> --
> 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
>
--
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