Hi all....I found a lot of tutorials about the above BUT....I'm a newbie and I would like to combine this with my code:
here is the tutorial code (I found others very similar to this):
$result = mysql_query (SELECT * FROM table);
if ($row = mysql_fetch_array($result)) {
//run the for loop
for ($i = 0; i < count($row); $i++) {
// Set Table Row Color
if ($i % 2) {
echo "<tr bgcolor=B0C4DE>";
} else {
echo "<tr bgcolor=FOF8FF>";
}
// Now display our table cell info
}
?>
<td><? echo $row["whatever"]; ?></td>
</tr>
</table>
<? }
?>
and this is my code where I have a $color variable to assign the correct font color to the belonging "ruolo"
$result = mysql_query("SELECT * FROM giocatori",$db);
<?PHP
echo "<TABLE BORDER=\"1\">\n";
echo "<TR bgcolor=\"lightblue\"><TD>Ruolo</TD><TD>Nomee</TD></TR>\n";
while($myrow = mysql_fetch_array($result))
{
$ID_giocatore = $myrow["ID_giocatore"];
$ruolo = $myrow["ruolo"];
$nome = $myrow["nome"];
if($ruolo < C)
{
$color = "RED";
}
elseif($ruolo < D)
{
$color = "GREEN";
}
elseif($ruolo < P)
{
$color = "BLUE";
}
else
{
$color = "BLACK";
}
echo "<TR><TD>\n";
echo "<font color=$color>$ruolo</font>\n";
echo "</TD>\n";
echo "<TD>\n";
echo "<font color=$color>$nome</font>\n";
echo "</TD>\n";
}
echo "</TABLE>\n";
?>
</BODY>
</HTML>
I tryed to combine the 2 things but I'm not having it working properly.....
will you be so kind to help a poor newbie ???
thanx
Roberto