I am making a booking system in php using codeigniter
. Now I want to populate the events in full calender depending on the value I am fetching from the database.
My code :
<script src='<?php echo base_url();?>assets/fullcalendar/fullcalendar.min.js'></script>
<?php
$var=0;
foreach($query->result() as $row) {
$var++;
$booking_date = $row->booking_date;
$booking_start_time = $row->booking_start_time;
}
?>
<script>
$(document).ready(function() {
// page is now ready, initialize the calendar...
var booking_date = '<?php echo $booking_date; ?>';
var booking_start_time = '<?php echo $booking_start_time; ?>';
$('#calendar').fullCalendar({
header: {
left: 'prev,next today',
center: 'title',
right: 'month,agendaWeek,agendaDay'
},
events: [{
title: 'House Cleaning',
start: booking_date + 'T' + booking_start_time,
allDay: false
}]
});
});
</script>
Using above I am able get the last record populated on the full calender. I want to populate each record fetched from the database to the full calender js
. How do I go about it.
Thanks in advance and apologies if I am being vague but I am always ready to explain further based on the question.
Thanks,