Ci sono riuscito ma ricevo un errore mostruoso
codice:
<HTML>
<HEAD>
</HEAD>
<table border="0" cellspacing="0" cellpadding="3" width="100%">
<tr>
<td title="Nome Clan" height="30" background="http://www.ligaa.org/style_images/automnev2e/tile_cat.gif">
<p align="left"><font color="#FFFFFF">Clan</font></td>
<td title="Punti" width="50" background="http://www.ligaa.org/style_images/automnev2e/tile_cat.gif">
<p align="left"><font color="#FFFFFF">Punti</font></td>
<td title="Partite Giocate" width="50" background="http://www.ligaa.org/style_images/automnev2e/tile_cat.gif">
<p align="left"><font color="#FFFFFF">P.G.</font></td>
<td title="Partite Vinte" width="50" background="http://www.ligaa.org/style_images/automnev2e/tile_cat.gif">
<p align="left"><font color="#FFFFFF">P.V.</font></td>
<td title="Partite Pareggiate" width="50" background="http://www.ligaa.org/style_images/automnev2e/tile_cat.gif">
<p align="left"><font color="#FFFFFF">P.Pa.</font></td>
<td title="Partite Perse" width="50" background="http://www.ligaa.org/style_images/automnev2e/tile_cat.gif">
<p align="left"><font color="#FFFFFF">P.P.</font></td>
<td title="Round Vinti" width="50" background="http://www.ligaa.org/style_images/automnev2e/tile_cat.gif">
<p align="left"><font color="#FFFFFF">R.V.</font></td>
<td title="Round Persi" width="50" background="http://www.ligaa.org/style_images/automnev2e/tile_cat.gif">
<p align="left"><font color="#FFFFFF">R.P.</font></td>
</tr>
</table>
</div>
<?php
$host="localhost";
$user="ligaa";
$pass="bvnms8x0";
$db_name="ligaa";
$db=mysql_connect ($host, $user,$pass);
if ($db == FALSE)
die ("Errore nella connessione.");
mysql_select_db($db_name, $db)
or die ("Errore nella selezione del database.");
$stampa = "SELECT *, (golfatti - golsubiti) as diffr FROM ibf_ligaa_clan where idcomp=1 ORDER BY punti DESC, diffr DESC";
$query = mysql_query ($stampa,$db) or die ("Non riesco ad eseguire la richiesta $stampa");
while($row = mysql_fetch_array($query)) {
if ($row['result1'] > $row['result2']) {
$color = 'green';
}
else if ($row['result1'] < $row['result2']) {
$color = 'red';
}
else {
$color = 'orange';
}
?>
<table border="1" cellspacing="0" cellpadding="3" style="border-collapse: collapse" bordercolor="#000000" width="100%">
<tr>
<td bgcolor="<?php echo $color; ?>"><?php echo $row['field1']; ?><p align="left"> <?php echo "".$row['TAG']; ?></td>
<td width="50" bgcolor="<?php echo $color; ?>"><?php echo $row['field1']; ?><p align="left"> <?php echo "".$row['punti']; ?></td>
<td width="50" bgcolor="<?php echo $color; ?>"><?php echo $row['field1']; ?><p align="left"> <?php echo "".$row['giocate']; ?></td>
<td width="50" bgcolor="<?php echo $color; ?>"><?php echo $row['field1']; ?><p align="left"> <?php echo "".$row['vinte']; ?></td>
<td width="50" bgcolor="<?php echo $color; ?>"><?php echo $row['field1']; ?><p align="left"> <?php echo "".$row['pareggiate']; ?></td>
<td width="50" bgcolor="<?php echo $color; ?>"><?php echo $row['field1']; ?><p align="left"> <?php echo "".$row['perse']; ?></td>
<td width="50" bgcolor="<?php echo $color; ?>"><?php echo $row['field1']; ?><p align="left"> <?php echo "".$row['golfatti']; ?></td>
<td width="50" bgcolor="<?php echo $color; ?>"><?php echo $row['field1']; ?><p align="left"> <?php echo "".$row['golsubiti']; ?></td>
</tr>
</table>
</div>
<?php
mysql_free_result ($query);
}
?>
Mi stampa la pagina, rispettando il layout ma invece di elencarmi tutte e 10 le squadre, si vede la prima riga arancione e mi da un'errore relativo alla linea 37 cioè questa:
codice:
while($row = mysql_fetch_array($query)) {
Warning: mysql_fetch_array(): 3 is not a valid MySQL result resource in /home/site/public_html/tournament/a/prova2.php on line 37