:: Alternate Color::
$query="SELECT * FROM ".$tablename." WHERE cst_country LIKE '%$s_country%'";
$res=$dbHandle[$DBIndex]->RunQuery($query);
$color1 = "#F7EBDE";
$color2 = "#F7DFCE";
$row_count = 0;
echo"<--table cellspacing=0 cellpadding=0 border=1 valign=top-->";
while ($row = $res->fetchRow()) {
$row_color = ($row_count % 2) ? $color1 : $color2;
$i_value=number_format($row['cst_value'], 3, '.', '');
echo "<--tr bgcolor=\"$row_color\"-->";
echo "<--/tr-->";
$row_count++;
}
echo"<--/table>
1) Declare the desired color $color1 and $color2 and $row_count=0
2) Pastuh letak kan kira2 dier ( $row_color = ($row_count % 2) ? $color1 : $color2; ) dalam looop
3) then letakkan bgcolor=$row_color dlm row kiter
4) buat increment utk row color $row_count++
No comments:
Post a Comment