ripensandoci però scusa.. se stampi per ogni record una tabella non fai prima a mettere direttametne il colore che vuoi nel codice html?

nel caso usassi un'unica tabella allora quello che ti ho detto prima ha anche un senso, ma in questo caso ti conviene fare

Codice PHP:
print "
<table>
<tr style=\"background:#f00;\"><td>....</td></tr>
<tr style=\"background:#0f0;\"><td>....</td></tr>
</table>"

oppure invece che usare style creare una classe nel file css .bg1 e .bg2 e mettere


Codice PHP:
print "
<table>
<tr class=\"bg1\"><td>....</td></tr>
<tr class=\"bg2\"><td>....</td></tr>
</table>"