Ok, I’ve decided to work with the mysql result which has turned out a little easier as mentioned. What you have suggested above is exactly what I need for my new snippet @fretburner VCALENDAR and VEVENT are no longer in use.
Just wondering how we can fit the ARRAY_FILTER and SORT into the new snippet below. Not sure if I need to create a new DateTime now - I have the row already formatted as shown below.
ORDER BY will be removed (somebody said PHP sorting is faster than SQL) is that correct?
$queryEvents = "
SELECT ID
, DTEND
, DTSTAMP
, LOCATION
, DTSTART
, SUMMARY
FROM events_test
ORDER BY DTSTART ASC";
$resultEvents = $mysqli->query($queryEvents);
$row_cnt = $resultEvents->num_rows;
$eventsArray = array();
/* fetch associative array */
while ($row = $resultEvents->fetch_assoc()) {
$row['endTime'] = date('g:ia', strtotime($row['DTEND']));
$row['fullDate'] = date('l jS F Y', strtotime($row['DTSTART']));
$row['startTime'] = date('g:ia', strtotime($row['DTSTART']));
$eventsArray[] = $row;
}
And further down the page I show the results:
foreach($eventsArray as $value){ echo "<li><a href='event/{$value['ID']}'> {$value['SUMMARY']}<br> {$value['LOCATION']}<br> {$value['startTime']} - {$value['endTime']}</a></li>"; }
Some guidance cheers.
I’ll also be looking for a way to group these events into separate lists grouped under a date title, if maybe we could include this with the update somehow.
I came across array_chunk() though after further searching it seems a double foreach inside one another could be the right solution?
23rd June
event
event
event
24th June
event
event
event
…
Thanks, Barry