I use the following SQL query to select rows from an inner join sorted by date.
SELECT * FROM clubnights INNER JOIN club ON clubnights.club = club.club_ID WHERE visibility = 0 AND date >= CURDATE() ORDER BY clubnights.date ASC
Then I load all the data into my HTML through the PHP while loop.
My goal is an HTML echo header over every section of any date.
Therefore, I am looking to detect (via PHP or SQL) when a date change is detected using a select query. Basically, I want to compare the last column of "date" with the current one, and if they do not match, I will echo through PHP.
As an example, suppose the following lines:
2016-09-16 - Row 1 // Detect 'change' here as it the first row 2016-09-16 - Row 2 2016-09-16 - Row 3 2016-09-16 - Row 4 2016-09-16 - Row 5 2016-09-17 - Row 6 // Detect change here as date has changed 2016-09-17 - Row 7 2016-09-17 - Row 8
Edit: I am using MySQL
source share