Every second row printed from mysql should be colored


Staff member
I have a contact form at my wordpress site, which it's data to mysql and also sends it with mail. I'm currently working on a simple wep app that simply reads the data from the database and prints it. To make it easier to read on mobile, I want that every second row printed from the database would be gray and every second white. I tried this but failed miserably, as you can see from the code. So I want it to look this:
<a href="http://i49.tinypic.com/20fbvdi.png" rel="nofollow">http://i49.tinypic.com/20fbvdi.png</a>
And here's the code:

&lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8"&gt;

$con = mysql_connect("localhost","user","pass");
if (!$con)
  die('Could not connect: ' . mysql_error());

mysql_select_db("database", $con);

$result = mysql_query("SELECT * FROM wp_contactform");

echo "&lt;table border='1'&gt;
&lt;th style='width:10%;'&gt;ID&lt;/th&gt;
&lt;th style='width:10%;' class='anotherrow'&gt;Nimi&lt;/th&gt;
&lt;th style='width:10%;'&gt;Puhelin&lt;/th&gt;
&lt;th style='width:10%;' class='anotherrow'&gt;Sposti&lt;/th&gt;
&lt;th style='width:40%;'&gt;Viesti&lt;/th&gt;
&lt;th style='width:10%;' class='anotherrow'&gt;P&amp;auml;iv&amp;auml;&lt;/th&gt;
&lt;th style='10%;'&gt;IP&lt;/th&gt;

while($row = mysql_fetch_array($result))
  echo "&lt;tr&gt;";
  echo "&lt;td style='width:10%;'&gt;" . $row['ID'] . "&lt;/td&gt;";
  echo "&lt;td style='width:10%;' class='anotherrow'&gt;" . $row['Nimi'] . "&lt;/td&gt;";
  echo "&lt;td style='width:10%;'&gt;" . $row['Puhelin'] . "&lt;/td&gt;";
  echo "&lt;td style='width:10%;' class='anotherrow'&gt;&lt;a href='mailto:" . $row['Email'] . "'&gt;" . $row['Email'] . "&lt;/a&gt;&lt;/td&gt;";
  echo "&lt;td style='width:40%;'&gt;" . $row['Viesti'] . "&lt;/td&gt;";
  echo "&lt;td style='width:10%;' class='anotherrow'&gt;" . $row['Day'] . "&lt;/td&gt;";
  echo "&lt;td style='width:10%;'&gt;" . $row['IP'] . "&lt;/td&gt;";
  echo "&lt;/tr&gt;";
echo "&lt;/table&gt;";


Please don't get nightmares from the code, it's valid enough for me, and I'm the only one using the web app :)