PHP alternating colors
Posted
by Jordan Pagaduan
on Stack Overflow
See other posts from Stack Overflow
or by Jordan Pagaduan
Published on 2010-05-31T01:51:29Z
Indexed on
2010/05/31
2:02 UTC
Read the original article
Hit count: 351
php
$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?
© Stack Overflow or respective owner