Salve a tutti!
Ho una funzione che mi stampa i record di una SELECT in una tabella.
Il codice è questo:
Codice PHP:
Function home($flag){
@mysql_connect("localhost", "root", "") or die("Connessione fallita !");
@mysql_select_db("mydb") or die("Selezione Database fallita !");
$sql="SELECT * from news where categoria='$flag' ORDER BY id DESC LIMIT 2";
$select = @mysql_query($sql) or die("Query fallita !");
while($riga=mysql_fetch_array($select)){
$id=$riga["id"];
$titolo1=$riga["descrizione"];
$collega=$riga["collegamento"];
$data=$riga["data_news"];
$fonte=$riga["fonte"];
echo"<table width=\"370\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">";
echo"<tr>";
echo" <td class=\"newstesto\"><A HREF=\"$collega\"target=\"_blank\">$titolo1<a></td>";
echo" </tr>";
echo"<tr>";
echo" <td class=\"data\">$fonte. $data</td>";
echo" </tr>";
echo"</table>";
}
}
Io vorrei che il colore di sfondo delle righe si alternasse.
Come posso fare?
Grazie!