Kristoff1875 Posted April 13, 2014 Share Posted April 13, 2014 Currently i'm using the following: SELECT res.*, u.*, t.* FROM Results res INNER JOIN Users u USING (UserID) INNER JOIN Teams t USING (TeamID) WHERE RaceID = '$RaceID' AND Position = '1' Which is getting race details. <div class="ScheduleRace" style="background-image:url(images/tracks/<?=$row['Image']?>.jpg);"> <div class="topstrip"> <div style="float:left;"><?= 'Raceday '.$row['Raceday'].' - Race '.$row['RaceNum'].'. <strong>'; if ($row['Title'] !== '') { echo $row['Title'].' '; } echo $row['Track'].'</strong></div><div style="float:right;">'.date("d/m/Y - H:i", strtotime($row['Date'])).'</div><div style="clear:both;"></div>';?> </div> </div> Each raceday consists of 3 races, the track, date, raceday is the same, but the times change. Do I need to have a second while inside this one to have the individual race details to group them together as follows: <div class="ScheduleRace" style="background-image:url(images/tracks/<?=$row['Image'];?>.jpg);"> <?='Raceday '.$row['Raceday'].' - '.date("d/m/Y - H:i", strtotime($row['Date'])).'; if ($row['Title'] !== '') { echo $row['Title'].' '; } ?> //SECOND WHILE STATEMENT HERE <div class="topstrip"> <div style="float:left;"><?= 'Race '.$row['RaceNum'];?></div> <div style="float:right;"><?= '.date("H:i", strtotime($row['Date']));?></div> </div> <div class="topstrip"> <div style="float:left;"><?= 'Race '.$row['RaceNum'];?></div> <div style="float:right;"><?= '.date("H:i", strtotime($row['Date']));?></div> </div> <div class="topstrip"> <div style="float:left;"><?= 'Race '.$row['RaceNum'];?></div> <div style="float:right;"><?= '.date("H:i", strtotime($row['Date']));?></div> </div> </div> Or is there a way to group the date and image and still loop the rest of the results inside the divs produced? Link to comment https://forums.phpfreaks.com/topic/287741-group-different-results-together-if-date-not-time-is-the-same/ Share on other sites More sharing options...
Kristoff1875 Posted April 13, 2014 Author Share Posted April 13, 2014 Apologies, my query is: SELECT * FROM Races WHERE SeasonNumber = '$SeasonNumber' AND LeagueID = '$LeagueID' ORDER BY Date ASC Link to comment https://forums.phpfreaks.com/topic/287741-group-different-results-together-if-date-not-time-is-the-same/#findComment-1475978 Share on other sites More sharing options...
Kristoff1875 Posted April 13, 2014 Author Share Posted April 13, 2014 Ignore this, i've sorted it. Link to comment https://forums.phpfreaks.com/topic/287741-group-different-results-together-if-date-not-time-is-the-same/#findComment-1475996 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.