Alternating Rows of mysql data in different colors
Posted: Sat Aug 16, 2003 8:31 pm
Hi--
I am trying to write an if statement which will check if a row returned from a mysql query is odd or even, and then set the bg color of the <tr> Table Row of the html table to be built from the rows, to be set to an alternating color.
I have several different columns to be displayed, and I have it set as this now:
...and a few more. So I guess just a line at the top changing the <tr bgcolor="#eff3fe"> would be best... 
Thank You!
All My Best,
Jeffrey
I am trying to write an if statement which will check if a row returned from a mysql query is odd or even, and then set the bg color of the <tr> Table Row of the html table to be built from the rows, to be set to an alternating color.
I have several different columns to be displayed, and I have it set as this now:
Code: Select all
<?php
while($row = mysql_fetch_array($query)) {
{
?>
<tr bgcolor="#eff3fe">
<td width="61" height="21">
<p style="margin-left: 10; margin-right: 10">
<font face="Verdana" size="1">
<?php echo $row["til_id"]; ?>
</font>
</td>
<td width="86" height="21">
<p style="margin-left: 10">
<font face="Verdana" size="1">
<?php echo $row["category"]; ?>
</font>
</td>
<td width="33%" height="21">
<p style="margin-left: 10">
<font face="Verdana" size="1">
<?php echo $row["question"]; ?>
</font>
</td>
<td align="left" width="78" height="21">
<p style="margin-left: 10">
<font face="Verdana" size="1">
<?php echo $row["created"]; ?>
</font>
</td>
?>Thank You!
All My Best,
Jeffrey