The situation
I have a MySQL Database Table with many dates in it.
Now I need to create a table from this tableentries which should look like this:
May | |
22.05.2014 | Person 1 | Person 2
23.05.2014 | Person 1 | Person 2
June | |
02.06.2014 | Person 1 | Person 2
25.06.2014 | Person 1 | Person 2
etc..
The code
I am now trying to create a loop through all my query results to do so. And right there I stuck.
I am having something like this:
In the "while" (fetch assoc) loop I have this:
while ($row = $stmt->fetch(PDO::FETCH_ASSOC)) {
$date = $row['pp_date'];
$month = date('m', strtotime($date));
$entryarray = array();
}
You can see, that I first save the month of the date into the array. And now I don't know, how to create the array to hold all rows for each month in the array to finally output the result into the table.