Adding table background colors?
Posted: Sun Sep 03, 2006 10:50 pm
hi
How would I edit the code below to alternate row background colors or the resulting table?
thanks
How would I edit the code below to alternate row background colors or the resulting table?
Code: Select all
<table cellspacing=5 cellpadding=5 border=0>
<tr>
<td><strong>ID</strong></td>
<td><strong>Name</strong></td>
<td><strong>Email</strong></td>
<td><strong>Price</strong></td>
<td><strong>Date</strong></td>
<td></td>
</tr>
<?
/* Retrieves the rows from the query result set
and puts them into a HTML table row */
while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
$ptotal = $row["pprice1"] + $row["pprice2"] + $row["pprice3"] + $row["pprice4"] + $row["pprice5"];
echo("<tr>\n<td>" . $row["id"] . "</td>");
echo("<td>" . $row["name"] . "</td>");
echo("<td>" . $row["email"] . "</td>");
echo("<td>$" . $ptotal . "</td>");
echo("<td>" . $row["date"] . "</td>");
echo("<td><a href=\"" . $quote_url .$row['id'] . "\">View</a> | <a href=\"" . $_SERVER['PHP_SELF'] . "?id=" .$row['id'] . "&Submit=Edit\">Edit</a> | <a href=\"" . $_SERVER['PHP_SELF'] . "?id=" .$row['id'] . "&Submit=Delete\">Delete</a></td></tr>\n\n");
}
/* Closes the table */
?>
</table>