php td Alternate row colors
Posted: Sat Apr 23, 2011 1:58 pm
I'm wondering how to go about specifying alternate row colour backgrounds (eg white first row, grey the second row, and alternating thereafter.
below is my partial php code td i'm using to output row data from a database. anyone have any ideas on how to modify it to include alternating bg row colors? thanks.
below is my partial php code td i'm using to output row data from a database. anyone have any ideas on how to modify it to include alternating bg row colors? thanks.
Code: Select all
<?php
if($result==true)
{
do
{
echo "<tr>";
echo '<td nowrap><a href="details.php?IDNumber=' . $result['IDNumber'] . '">' . $result['IDNumber'] . '</a></td>';
echo '<td nowrap>' . $result['Beneficiary'] . '</td>';
echo '<td nowrap>' . $result['CompanyBranch'] . '</td>';
echo '<td nowrap>' . $result['CompanyName'] . '</td>';
echo '<td nowrap>' . $result['CompanyReferenceNumber'] . '</td>';
echo "</tr>";
}
while($result = mysql_fetch_array($query));
}
// close table>
echo "</table><hr>";
?>