I have a while loop for matches with rounds:
while ( $matches->fetch() )
{
echo $round . '.'; //need a condition to only echo round if it is for the first time
echo $team1 . ' VS ' . $team2;
}
So, instead of the result e.g.:
1.FC BARCELONA VS REAL MADRID
1.MALAGA VS SEVILLA
1.ATLETICO BILBAO VS MADRID
1.MALLORCA VS REAL MADRID
2.FC BARCELONA VS REAL MADRID
2.MALAGA VS SEVILLA
2.ATLETICO BILBAO VS MADRID
2.MALLORCA VS REAL MADRID
I need to echo the number of the round only once in the first row like that:
1.FC BARCELONA VS REAL MADRID
MALAGA VS SEVILLA
ATLETICO BILBAO VS MADRID
MALLORCA VS REAL MADRID
2.FC BARCELONA VS REAL MADRID
MALAGA VS SEVILLA
ATLETICO BILBAO VS MADRID
MALLORCA VS REAL MADRID
How to do that within while loop? I need some if or other condition, but I am out of ideas how to code this, so any help is appreciated.
I have ordered them correctly but need to do the output part now.
Track the last round, and only display if it’s changed.