I made a calendar using this tutorial
https://www.phpzag.com/create-event-calendar-with-jquery-php-and-mysql/#
Now I want to have multiple calenders like this:
I have a query that gets all the data then this is getting converted to JSON.
Code for JSON:
$calendar = array();
while( $rows = $sqlEvents->fetch(PDO::FETCH_ASSOC)) {
$start = strtotime($rows['DatumBegin']) * 1000;
$end = strtotime($rows['DatumEind']) * 1000;
$calendar[] = array(
'id' =>$rows['OpleidingID'],
'title' => $rows['Onderdeelnaam'],
'url' => "",
"class" => 'event-important',
'start' => "$start",
'end' => "$end"
);
}
$calendarData = array(
"success" => 1,
"result"=>$calendar
);
echo json_encode($calendarData);
The problem that I have is that all data goes in all calendars
Right now it goes like this
Data from Person A, Person B, Person C
Calendar A = A B C
Calendar B = A B C
Calendar C = A B C
But what I want is this
Calendar A = A
Calendar B = B
Calendar C = C
How could I seperate the json data so that it's like the example above.
Code for calling in calendar:
$docenten = array();
while( $rows = $sqlEvents->fetch(PDO::FETCH_ASSOC)) {
$docenten[] = $rows;
}
if(isset($docenten)){
foreach ($docenten as $docent)
{
?>
<table class="table table-condensed table-bordered">
<tr>
<td class="agenda-date" class="active" rowspan="4" style="height: 125px; width: 12%;">
<div class="dayofweek">
<b>
<?php echo $docent['Docentnaam']; ?>
</b>
</div>
<div class="dayofweek">
<?php echo $docent['Email']; ?>
</div>
<div class="shortdate">
<?php echo $docent['Telefoonnummer']; ?>
</div>
<div class="shortdate">
<?php echo $docent['Mobiel']; ?>
</div>
</td>
</tr>
<td style="width: 100%;">
<div class="showEventCalendar cal-context"></div>
</td>
</table>
The json data is sent to events.js and gets converted so that it can be placed in <div class="showEventCalendar cal-context"></div>