Another thing you can do is declare an array of background colors and cycle through them automatically, like so:
PHP Code:
<table border='0'>
<?php
$num = 20;
$colors = array('#ff9999','#99ff99','#9999ff');
for($i=0; $i<$num; $i++) {
$bgcolor = $colors[ $i % count($colors) ];
echo "<tr bgcolor='$bgcolor'><td>This is line number $i</td></tr>";
}
?>
</table>