Possible Duplicate:
How to set alternate row color for an iterated table in php?
Using CSS :even and :odd pseudo-classes with list items
I have a html table populated with data from a mysql table. I use the following code:
$result = mysql_query("SELECT * FROM {$table}");
if (!$result) {
die("Query to show fields from table failed");
}
$fields_num = mysql_num_fields($result);
echo "<h1>Table: {$table}</h1>";
echo "<tr>";
echo "</tr>\n";
while($row = mysql_fetch_row($result))
{
echo "<tr>";
foreach($row as $cell)
echo "<td>$cell</td>";
echo "</tr>\n";
}
mysql_free_result($result);
Note: I normally use PDO statments but for this example i use mysql.
The code generate the table correctly. The question is: I want to apply a CSS to every second row with the following class=table_higlight. How can I do this?
:evenand:oddhave a poor browser compatibility...