Hey,
I have a table that grabs data from a MySQL database, and I was wondering how it is possible to have each <tr> alternate colors, from white to grey.
Any help would be appreciated.
Thanks.
You can do this for the whole table, the row, or the element.
$x=1; //counter for row color
//code here for data query and out put while ($result = ($myQuery)){
if ($x==1) { echo "<tr bgcolor="white"> $x=0; }else{ echo "<tr bgcolor="grey"> $x=1; } echo "<td>$item1</td><td>item2</td></tr>";
}
hth
bastien
Thanks Bastien,
That's exactly what I was was looking for and it works great.