Vorrei fare una cosa che penso sia possibile, ovvero controllare un campo in una tabella del db e se il valore è 0 stampare $nocomp, se è diverso con else stampare comp...
Ho abbozzato un codice, ma mi sa che ho fatto un po di casino nell'html, me lo potete controllare e dirmi dove sbaglio?
Codice PHP:
<?php
$host="localhost";
$user="xxxx";
$pass="xxxx";
$db_name="xxxxx";
$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.");
$nocomp = "[b]<font color=red>Non vi sono campionati attivi al momento.</font>[/b]";
$comp = <<<EOF
<table border="0" width="100%" cellspacing="0" cellpadding="0">
<tr>
<td>
<table border="1" width="100%" height="30" cellspacing="" cellpadding="3" style="border-collapse: collapse" bordercolor="#000000" background="immagini_portale/tile_cat.gif">
<tr>
<td title="Nome Clan"><div align="left"><span class="Stile1">Clan</span></div></td>
<td title="Punti" width="50"><div align="left"><span class="Stile1">Punti</span></div></td>
<td title="Partite Giocate" width="50"><div align="left"><span class="Stile1">P.G.</span></div></td>
<td title="Partite Vinte" width="50"><div align="left"><span class="Stile1">P.V.</span></div></td>
<td title="Partite Pareggiate" width="50"><div align="left"><span class="Stile1">P.Pa.</span></div></td>
<td title="Partite Perse" width="50"><div align="left"><span class="Stile1">P.P.</span></div></td>
<td title="Round Vinti" width="50"><div align="left"><span class="Stile1">R.V.</span></div></td>
<td title="Round Persi" width="50"><div align="left"><span class="Stile1">R.P.</span></div></td>
</tr>
</table>
<?php
$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");
echo "<table width=\"100%\" cellspacing=\"0\" cellpadding=\"3\" border=\"1\" style=\"border-collapse: collapse\" bordercolor=\"#d3d2d2\">\n";
while($Row = mysql_fetch_array($query)) {
echo "<tr class=\"out\" onmouseover=\"this.className='over'\" onmouseout=\"this.className='out'\">\n";
echo "<td class=\"Stile8\" onmouseover=\"this.className='sopra'\" onmouseout=\"this.className='fuori'\"><div align=\"left\">" .$Row['TAG']. "</div></td>\n";
echo "<td width=\"50\" height=\"25\"><div align=\"left\"><span class=\"Stile8\">" .$Row['punti']. "</span></div></td>\n";
echo "<td width=\"50\"><div align=\"left\"><span class=\"Stile4\">" .$Row['giocate']. "</span></div></td>\n";
echo "<td width=\"50\"><div align=\"left\"><span class=\"Stile5\">" .$Row['vinte']. "</span></div></td>\n";
echo "<td width=\"50\"><div align=\"left\"><span class=\"Stile6\">" .$Row['pareggiate']. "</span></div></td>\n";
echo "<td width=\"50\"><div align=\"left\"><span class=\"Stile7\">" .$Row['perse']. "</span></div></td>\n";
echo "<td width=\"50\"><div align=\"left\"><span class=\"Stile5\">" .$Row['golfatti']. "</span></div></td>\n";
echo "<td width=\"50\"><div align=\"left\"><span class=\"Stile7\">" .$Row['golsubiti']. "</span></div></td>\n";
echo "</tr>\n";
}
echo "</table>\n";
?>
</td>
</tr>
</table>
EOF;
$stampa = "Select * From ibf_ligaa_competizioni limit 1";
$query = mysql_query ($stampa,$db) or die ("Non riesco ad eseguire la richiesta $stampa");
while($Row = mysql_fetch_array($query)) {
if ($Row ['attiva'] == 0){
echo $nocomp;
}else{
echo $comp;
}
}
?>