PHP alternating colors
- by Jordan Pagaduan
$dbc = mysql_connect('localhost','root','') or die (mysql_error());
mysql_select_db('payroll') or die (mysql_error());
$sql = "SELECT * FROM employee ORDER BY employee_id DESC";
$result = mysql_query($sql);
while($row = mysql_fetch_array($result)) {
echo "
<tr>
<td style=\"padding-left: 20px; border-bottom: 1px solid #999; border-right: 1px solid #999;\">".$row['first_name']." ".$row['last_name']."</td>
<td style=\"text-align: center; border-bottom: 1px solid #999; border-right: 1px solid #999; padding-top: 2px ; padding-bottom: 3px ;\"><input type=\"button\" name=\"edit\" value=\"Edit\" class=\"selbtn\"> <input type=\"button\" name=\"delete\" value=\"Delete\" class=\"selbtn\"></td>
</tr>
";
}
I wanted to add an alternating color in the loop. what code should I add?