Tables
|
|
|
|
<?php //the swicth is set to odd and the if statement alternates it and the color
$switch = "odd";
while($row = mysql_fetch_object($result)) {
echo $switch;
/////////////////////////////////////////////
// if switch odd to even
// Var $switch even : odd
// Var $color that is swithced
/////////////////////////////////////////////
if ($switch == "odd")
{
$color ="#000033";
$switch = "even";
}
else
{
$color = "#CCCCC";
$switch = "odd";
}
// Var $color that is alternated
echo "<tr bgcolor='$color'>";
echo "<td>".$row->ex_Name."</td>";
echo "<td>".$row->ex_Des."</td>";
echo "</tr>";
}
echo "</table>"; ?>
|
|
|
Usage Example
|
|
|
Rate This Script
|
|
|
|