- Home
- Categorie
- Coding e Sistemistica
- Coding
- Piccolo problema con una tabella
-
Piccolo problema con una tabella
Ciao a tutti , piccola premessa non sono un campione in php .
Allora ecco il mio problema in questa funzione non riesco a togliere gli incontri che sono a zero minuti(cioé risultati in attesa), in pratica vorrei che nella tabella ci fossero sempre le partite non ancora chiuse cioé non a 0 minuti.
Se volete piu info chiedete e vi rispondo.
Se qualcuno mi potrebbe aiutare mi farebbe un grande piacere.
Vi ringrazio anticipatamente .
Paolofunction cal_home ($gr_champ)
{
$query="SELECT phpl_clubs.nom, CLEXT.nom, phpl_matchs.buts_dom, phpl_matchs.buts_ext, phpl_matchs.id, phpl_matchs.date_reelle, phpl_journees.numero
FROM phpl_clubs, phpl_clubs as CLEXT, phpl_matchs, phpl_journees, phpl_equipes, phpl_equipes as EXT, phpl_gr_championnats
WHERE phpl_clubs.id=phpl_equipes.id_club
AND CLEXT.id=EXT.id_club
AND phpl_equipes.id=phpl_matchs.id_equipe_dom
AND EXT.id=phpl_matchs.id_equipe_ext
AND phpl_matchs.id_journee=phpl_journees.id
AND phpl_journees.id_champ=phpl_gr_championnats.id_champ
AND phpl_gr_championnats.id
AND phpl_matchs.buts_dom is null
AND phpl_matchs.buts_ext is null
AND phpl_clubs.nom!='exempte'
AND CLEXT.nom!='exempte'
ORDER by phpl_matchs.date_reelle, phpl_matchs.id
LIMIT 0, 20";
$i=0;
$result=mysql_query($query) or die ("probleme " .mysql_error());
while ($row=mysql_fetch_array($result) and $i<30)
{
$clubs_nom = stripslashes($row[0]);
$clubs_nom1 = stripslashes($row[1]);
$query2= "SELECT pronostic
FROM phpl_pronostics, phpl_gr_championnats
WHERE phpl_pronostics.id_match='$row[4]'
AND phpl_gr_championnats.id";
$result2=mysql_query($query2) or die ("probleme " .mysql_error());
$nb_pronos= mysql_num_rows($result2);
if ($nb_pronos == "0") {$prono="0";}
{
while ($row2=mysql_fetch_array($result2))
{
$prono=$row2["0"];
if ($row2["0"] == ""){$prono="0";}
}
}
$date=format_date_fr_red($row[5]);
$date1 = format_heure_fr($row[5]);
echo "<tr><td class="tabb" align="center">$date</td>";
echo "<td class="tabb" align="center">$date1</td>";
echo "<td class="tabb" align="center">$clubs_nom - $clubs_nom1</td>";
$requete2="SELECT tps_avant_prono
FROM phpl_gr_championnats
WHERE id";
$resultats2=mysql_query($requete2) or die ("probleme " .mysql_error());
while ($row2=mysql_fetch_array($resultats2))
{
$temps_avantmatch=$row2[0];
}
$date_match_timestamp=format_date_timestamp($row[5]);
$date_actuelle=time();
$ecart_secondes=$date_match_timestamp-$date_actuelle;
$ecart_heures = floor($ecart_secondes / (6060))-$temps_avantmatch;
$ecart_minutes = floor($ecart_secondes / 60)-$temps_avantmatch60;
$ecart_jours = floor($ecart_secondes / (606024)-$temps_avantmatch/60);
$date = format_date_fr_red($row[5]);
echo "<td class="tab1b" align="center">";
if ($ecart_heures>48) echo "$ecart_jours Giorni";
elseif ($ecart_heures>0) echo "<font class="tab2b">$ecart_heures h</font>";
elseif ($ecart_heures == 0) echo "<font class="tab2b">$ecart_minutes min</font>";
else {echo"<font class="tab3b">Risultato in attesa</font>";}
echo "</td>";
echo "</tr>";
$i++;
}
}
-
nessuno mi puo aiutare ?
-
Se ci dici qual'è il campo dove troviamo zero minuti vediamo di aiutarti!
-
elseif ($ecart_heures == 0) echo "<font class="tab2b">$ecart_minutes min</font>";
-
Nel codice che hai postato non si vede dove viene generato questo campo, per cui il consiglio più semplice che ti posso dare è quello di mettere:
if ($ecart_minutes min == 0) continue;
All'interno del while e subito prima del primo echo!