I need to create a while loop that builds a table with alternating colors. I have the css setup but am not sure how write the loop. I’m building the table with data from a db query.
The table rows will look something like this when done:
[CODE]
<tr class=”even”>
<td width=”102″><img src=”assets/images/recSold/lionel.jpg” alt=”” /></td>
<td width=”212″><h2>Item Title</h2>
<p> Item number: 000000</p></td>
<td width=”73″><div align=”center”>1</div></td>
<td width=”61″><div align=”center”>Yes</div></td>
<td width=”92″><a href=”#”>EDIT THIS ITEM</a></td>
</tr>
<tr class=”odd”>
<td width=”102″ ><img src=”assets/images/recSold/tennis.jpg” alt=”” /></td>
<td width=”212″ ><h2>Item Title</h2>
<p> Item number: 000000</p></td>
<td width=”73″><div align=”center”>2</div></td>
<td width=”61″><div align=”center”>Yes</div></td>
<td width=”92″ ><a href=”#”>EDIT THIS ITEM</a></td>
</tr>
The PHP I have started is here:
[code=php]<?php $item_set = get_auction_items($public = false); ?>
<?php
while ($item = mysql_fetch_array($item_set)) {
// yeah I didn’t get too far
// is it possible to just check for even or odd rows somehow?
}
?>