so I have a couple of codes. this first code will paginate 3 months. so For example,
Page 1
March 2013
April 2013
May 2013
Page 2
June 2013
July 2013
August 2013
[php]$offset = isset($_GET[‘offset’]) ? intval($_GET[‘offset’]) : 0;
$currMonth = date(‘n’);
$list = array();
$list[] = mktime(0, 0, 0, $currMonth+$offset, 1);
$list[] = mktime(0, 0, 0, $currMonth+$offset+1, 1);
$list[] = mktime(0, 0, 0, $currMonth+$offset+2, 1);
foreach ($list as $dateTS)
{
echo date(‘M Y’, $dateTS) . ‘
’;
}
$prev = $offset-3;
$next = $offset+3;
echo “
Prev Next”;[/php]
Then I have this code that senses what months are covered for an event. so lets say it has a startdate of March 15 2013 and enddate of July 7 2013. This code finds that months covered are March, April, May, June, and July
[php]$start = new DateTime($start);
$end = new DateTime($end);
$inc = DateInterval::createFromDateString(‘first day of next month’);
$end->modify(’+1 day’);
$p = new DatePeriod($start,$inc,$end);
foreach ($p as $d)
echo $d->format(‘M’) . ‘
’;[/php]
So what I need is for the two codes to work together. I need to know how to select the events from the database, then combine these two codes together. My ultimate goal is to have the events show under the proper months that they occur in. so lets say I have 2 events, “test1” 2013-03-15 to 2013-07-04 and event “test2” 2013-03-08 to 2013-04-24
so it would look like this
Page 1
March 2013
Test 1
Test 2
April 2013
Test 1
Test 2
May 2013
Test 1
Page 2
June 2013
Test 1
July 2013
Test 1
August 2013
No events
can anyone help with this?