I'm trying to figure out how people use php and have tables output data as its rotating the background color of the rows.
If there's two rows of data in the table, I'd like it to print the first row with a background of (lets say) grey, then print the second row with a background of (lets say) white...
print '<table>';
$result = mysql_query("SELECT id,abc FROM table");
while($data=mysql_fetch_row($result)){
print '
<tr>
<td width="50%">' .$data[0]. '<td>
<td width="50%">' .$data[1]. '</td>
</tr>';
}
print '</table>';
This is an example of something off the top of my head but it doesn't have the code on how to rotate the colors. Anyone have an idea how to accomplish this?
Thanks