At 5:05 PM +0300 7/3/07, Andrei wrote:
Anyway you should get rid of echoing everything from php... It really
gets you mad when you want to change things...
while($row = mysql_fetch_array($result))
{
?>
<TR>
<TD bgcolor="<?=$rowColor?>">ID#, <?=$row[0]?></td>
<td bgcolor="<?=$rowColor?>">TicklerName, <?=$row[1]?></td>
etc...
</tr>
<?
}
Andrei:
Well don't -- use css instead:
First, define a background-color in a css class, like so:
.myRow0
{
background-color: yellow;
}
.myRow1
{
background-color: red;
}
Then in your php, assign:
$rowColor = 'myRow0'; // actually this is column color and not row color
?>
<TR>
<TD class="<?=$rowColor?>">ID#, <?=$row[0]?></td>
<td class="<?=$rowColor?>">TicklerName, <?=$row[1]?></td>
etc...
</tr>
<?php
Also, I wouldn't use short tags.
Plus, to alternate color *rows* in a table, just use:
<tr class="myRow<?php echo($i++ & 1 );?>">
<td whatever...
</tr>
See it work here:
http://www.webbytedd.com/b/color-rows/
It works better than anything I've read thus far.
Cheers,
tedd
--
-------
http://sperling.com http://ancientstones.com http://earthstones.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php