<style type="text/css">
.colore1 {
background-color:#ff0000;
}
.colore2 {
background-color:#0000ff;
}
</style>
Codice PHP:
$q = "SELECT * FROM Valutazioni WHERE Valutazione_classe=$classe AND Valutazione_sezione='$sezione' AND Valutazione_fascia='$fascia' AND Valutazione_data_voto='$data' AND Registro_docente='{$_SESSION['login']}' ORDER BY Valutazione_alunno_cognome, Valutazione_alunno_nome";
$query = mysql_query($q) or die(mysql_error());
$class = '';
$str = '<table>';
while ($row = mysql_fetch_assoc($query)) {
$class = $class == 'colore1' ? 'colore2' : 'colore1';
$str.= "<tr class=\"$class\">";
$str.= "<td>$row[Valutazione_alunno_cognome]</td>";
$str.= "<td>$row[Valutazione_alunno_nome]</td>";
$str.= "<td>$row[Valutazione_voto]</td>";
// eccetera
$str.= '</tr>';
}
$str.= '</table>';
echo $str;