带有while和foreach的错误循环


error loop with while and foreach

我想在下显示此表

September 2013
- 14/09/2013 | 14:30 | Football | League | Paris - Berlin
- 14/09/2013 | 19:30 | Volley | Cup | Paris - Barcelona
- 25/09/2013 | 12:00 | Football | Amical | Paris - Bordeaux 
October 2013
- 5/10/2013 | 15: 00 | Cup | Paris - Londres

这是我的代码

$dateQuery=mysql_query("SELECT matches.id,date_debut,date_fin,matches.score,sports.title AS sport,clubs1.itle AS recevant,clubs2.itle AS visiteur,competitions.title AS competition,matches.description,sexes.title AS sexeFROM匹配INNER在sex.id=matches.sexe_id上加入severesINNER在sports.id=matches.sport_id上加入体育INNER在clubs1.id=matches.recvant_id上以clubs1的身份加入俱乐部INNER在clubs2.id=matches.visiteur_id上以clubs2的身份加入俱乐部INNER在competitions.id=matches.contition_id上加入比赛其中CURRENT_DATE()<日期_日期ORDER BY date_debut ASC")或die(mysql_error());
while($row=mysql_fetch_assoc($dateQuery)){
   print '<b>'.$tIndexed[$row['date_debut'] ][ $row['sport'] ][]=date("d-m-Y",strtotime($row['date_debut'])).'</b><br />';
foreach($tIndexed as $sDate => $tIndexedDate){
    foreach($tIndexedDate as $sEvenement => $tIndexedEvenement){
        foreach($tIndexedEvenement as $sTexte){
            $sTexte = $row['recevant'].'-'.$row['visiteur'];
          print date("H:i",strtotime($row['date_debut'])).' | ' .$row['sport'].' | '.$row['competition'].' | '.$sTexte.' <br />';
        }
     }
  }
}

错误的结果显示

14-09-2013 14:30 | Football | Championnat de France | IOS ORLEANS-CSSM PARIS 14-09-2013 19:30 | Football | Championnat de France | CSSM PARIS-ASLS NANCY 19:30 | Football | Championnat de France | CSSM PARIS-ASLS NANCY 21-09-2013 15:00 | Football | Championnat de France | CSS RENNES-CSSM PARIS 15:00 | Football | Championnat de France | CSS RENNES-CSSM PARIS 15:00 | Football | Championnat de France | CSS RENNES-CSSM PARIS 28-09-2013 19:30 | Football | Championnat de France | CSSM PARIS-CSS RENNES 19:30 | Football | Championnat de France | CSSM PARIS-CSS RENNES 19:30 | Football | Championnat de France | CSSM PARIS-CSS RENNES 19:30 | Football | Championnat de France | CSSM PARIS-CSS RENNES

我希望你能帮我解决这个问题。

感谢

尝试这个

$dateQuery = mysql_query("SELECT DISTINCT matches.id, date_debut, date_fin, matches.score,     sports.title AS sport, clubs1.title AS recevant, clubs2.title AS visiteur, competitions.title AS competition, matches.description, sexes.title AS sexe
FROM matches
INNER JOIN sexes ON sexes.id = matches.sexe_id
INNER JOIN sports ON sports.id = matches.sport_id
INNER JOIN clubs AS clubs1 ON clubs1.id = matches.recevant_id
INNER JOIN clubs AS clubs2 ON clubs2.id = matches.visiteur_id
INNER JOIN competitions ON competitions.id = matches.competition_id
    WHERE CURRENT_DATE()<=date_debut
    ORDER BY date_debut ASC") or die(mysql_error());