Edit* I have found the issue. The date is being converted to this format: Mar 1 2018 12:00AM I have posted my solution below.
My query returns the appropriate results, however none of the events are showing up on the calendar.
Here's what the data looks like in SQL in case there's format issues I don't know about:
Name: Test
Start: 2009-09-23 00:00:00.000
End: 2010-04-05 00:00:00.000
PHP:
$query = mssql_query("select [NAME], [Start], [End] from [database] where [Name] = 'Test'");
$result = array();
if (mssql_num_rows($query)) {
while ($row = mssql_fetch_assoc($query)) {
$result[] = $row;
}
}
$data = array();
foreach($result as $i => $item)
{
$data[] = array(
'title' => $item["Name"],
'start' => $item["Start"],
'end' => $item["End"]
);
}
JSON/JS:
<script type="text/javascript">
$(document).ready(function() {
var calendar = $('#calendar').fullCalendar({
editable:true,
header:{
left: 'prev,next today',
center: 'title',
right: 'month,agendaWeek,agendaDay,listMonth'
},
events: <?php echo json_encode($data); ?> ,
selectable:true,
selectHelper:true,
})
});
</script>