Hello;
The closest I've come to finding a thread that solves this problem is
"MYSQL_FETCH_ARRAY without using while " ... I think it was in the database forum.
If I pull a bunch of calendar events out of a MySQL table, I will have a variable number of events per day. I can put these into a multidimensional array (Say, $$ResultArray[$DATE][] All the sorting by date and time has been done by the original SELECT query.
Once I have this array, I know I can show the whole thing with a FOREACH loop:
ie.
foreach ($ResultArray as $DATE => $content)
{
echo "<tr><th colspan=6, align=left>$DATE</th></tr>";
foreach ($content as $line => $event) {
echo "<tr><td>$event</td></tr>";
}
}
This works fine...to display ALL the days retrieved, showing all the events for each day.
Is there a way to use a FOR loop (or maybe some sort of While loop) to limit the number of days (say just the upcoming 5 days) displayed from $ResultArray...but include all events for each of the days displayed? (The way the select query is written, the dates are arranged in ascending order, so that will be the way the key ($DATES) will appear).
Thanks