Alternating Table Row Colors

wxdqz

New Member
I have data being pulled out of a MySQL Database and being put in a table. There are six columns and twenty rows or so currently in the table. Is there a way to alternate the color of each row of data in the table? Everything is kind of hard to read.

This is the code that generates the table:

// $result = mysql_query("SELECT * FROM meds",$db);
$result = mysql_query("SELECT medid, name, amount, dosage, doctor, taken FROM meds ORDER BY taken",$db);

while ($myrow = mysql_fetch_array($result)) {

echo "<tr>";
echo "<td width=190><a href=http://www.phpbuilder.com/board/archive/index.php/\"{$_SERVER['PHP_SELF']}?medid={$myrow['medid']}\">{$myrow['name']}</td>";
echo "<td width=90>{$myrow['amount']}</td>";
echo "<td width=100>{$myrow['dosage']}</td>";
echo "<td width=120>{$myrow['doctor']}</td>";
echo "<td width=100>{$myrow['taken']}</td>";
echo "<td width=100>";
printf("<div align=right><a href=http://www.phpbuilder.com/board/archive/index.php/\"%s?medid=%s&delete=yes\"><font size=1 color=#DADAF2>DROP</font></a></div>", $PHP_SELF, $myrow["medid"]);
echo "</td>";
echo "</tr>";


The background color of the table is #DADAF2 in its current state. It would be cool if each row would highlight when you moused over it like in myPHPadmin but I am sure that is way more work.

Thanks in advance!
 
Top