here is mine:
$bgarray = array ("blue","silver");
$i = 0;
while ($row=mysql_fetch_array($r
{
$j = $i % 2;
$strtdbg = $bgarray[$j];
echo "<TR>";
echo "<TD bgcolor=\"$strtdbg\">" . $row["col1"] ."</TD>";
echo "<TD bgcolor=\"$strtdbg\">" . $row["col2"] ."</TD>";
echo "</TR>";
}
OR use static variables across different scopes.
regards,
Spud =)
Main Topics
Browse All Topics





by: teuyPosted on 2001-04-24 at 11:46:28ID: 6029904
That is:
/TR>";
<TABLE BORDER=1>
<?php
$cnt = 0;
while ( ! $db->endofData() ) {
$data = $db->getrows(); // read data from table row by row
if (($cnt++)%2) $color="#AAAAAA"; // Almost Silver
else $color="#CCCCFF"; // Light Blue
print "<TR><TD bgcolor=$color>$data</TD><
}
?>
</TABLE>