Joueurs encore en jeu Téléthon

[insert_php]
$mysql_link = mysql_connect(« mysql51-58.pro », »emesetw-1″, »hVKp5DVpEqg8″) or die(« pb serveur mysql »);
$db_selected=mysql_select_db(« emesetw-1 »,$mysql_link) or die(« pb base »);
echo « 

« ;
echo « 

« ;
echo « 

« ;
echo « 

« ;
echo « 

« ;
$n=0;
// balayage des participants
$sql= »select idParticipant from TtournoiTelethon inner join adherent on TtournoiTelethon.idParticipant=adherent.ident order by nom »;
$resultListe=mysql_query($sql) or die($sql);
while ($liste=mysql_fetch_object($resultListe))
{
// participant encore en jeu a priori
$enJeu=1;
$nbMatchs=0;
// participant en joueur1
$sqlScores= »SELECT idParticipant, ScoreJoueur1,ScoreJoueur2 FROM TtournoiTelethon « .
« INNER JOIN TtournoiTelethon_matchs ON TtournoiTelethon_matchs.IdJoueur1 = TtournoiTelethon.idParticipant ».
 » where idParticipant= ».$liste->idParticipant;
$resultSqlScores=mysql_query($sqlScores) or die($sqlScores);
$nbMatchs+=mysql_num_rows($resultSqlScores);
while ($score=mysql_fetch_object($resultSqlScores))
{
if ($score->ScoreJoueur1<$score->ScoreJoueur2)
$enJeu=0;
}
// participant en joueur2
$sqlScores= »SELECT idParticipant, ScoreJoueur1,ScoreJoueur2 FROM TtournoiTelethon « .
« INNER JOIN TtournoiTelethon_matchs ON TtournoiTelethon_matchs.idJoueur2 = TtournoiTelethon.idParticipant ».
 » where idParticipant= ».$liste->idParticipant;
$resultSqlScores=mysql_query($sqlScores) or die($sqlScores);
$nbMatchs+=mysql_num_rows($resultSqlScores);
while ($score=mysql_fetch_object($resultSqlScores))
{
if ($score->ScoreJoueur2<$score->ScoreJoueur1)
$enJeu=0;
}
if ($enJeu==1)
{
$sqlNomPrenom= »select nom,prenom from adherent where ident= ».$liste->idParticipant;
$resultNomPrenom=mysql_query($sqlNomPrenom) or die ($sqlNomPrenom);
$listeNomPrenom=mysql_fetch_object($resultNomPrenom);
if ($n==1)
{
echo « 

« ;
$n=0;
}
else
{
echo « 

« ;
$n=1;
}
echo « 

« ;
echo « 

« ;
echo « 

« ;
}
}
echo « 

Joueur Nombre de matchs joués
« .utf8_encode($listeNomPrenom->prenom). » « .$listeNomPrenom->nom. » « .$nbMatchs. »

« ;
[/insert_php]