Adding table background colors?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
nado
Forum Newbie
Posts: 20
Joined: Tue Aug 29, 2006 3:47 am

Adding table background colors?

Post by nado »

hi

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>
thanks
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

search term: Zebra
nado
Forum Newbie
Posts: 20
Joined: Tue Aug 29, 2006 3:47 am

Post by nado »

feyd wrote:search term: Zebra
ah ok, thanks again
Post Reply