php - fullCalendar displaying everything as allDay -
i have created calendar saves mysql.
i have allday value set false time frame events calendar displays day.
this gets events..
$sql = mysql_query('select * `companies`.`calendar`'); ${'events'} = array(); while(${'event'} = mysql_fetch_assoc($sql)){ ${'events'}[] = ${'event'}; }
snapshot of table:
here jquery
$(document).ready(function() { $('#eventtoadd').dialog({ autoopen: false, height: '300', width: '550', modal: true, resizable: false, position: 'center', }); var date = new date(); var d = date.getdate(); var m = date.getmonth(); var y = date.getfullyear(); var calendar = $('#calendar').fullcalendar({ theme: true, header: { left: 'prev,next today', center: 'title', right: 'month,agendaweek,agendaday' }, loading: function(bool) { if (bool) $('#loading').show(); else $('#loading').hide(); }, eventclick: function(calevent, jsevent, view) { $('#eventtitle').val(calevent.title); $('#textcolor').val(calevent.textcolor); $('#backgroundcolor').val(calevent.color); $("#eventtoadd").dialog({ autoopen: true, title: "update event", modal: true, buttons: [ { text:"update event", click: function () { if($('#eventtitle').val()){ calevent.title = $('#eventtitle').val(); calevent.color = $('#backgroundcolor').val(); calevent.textcolor = $('#textcolor').val(); calendar.fullcalendar('updateevent',calevent); $.post('post.api.php', { 'api': 'updateevent', 'id': calevent.id, 'title': calevent.title, 'start': $.fullcalendar.formatdate(calevent.start, 'yyyy-mm-dd h:mm:ss tt'), 'end': $.fullcalendar.formatdate(calevent.end, 'yyyy-mm-dd h:mm:ss tt'), 'allday': calevent.allday, 'bgcolor': calevent.color, 'textcolor': calevent.textcolor }, function(resp) { if(resp == 'success') { jalert('the event has been updated','updated'); } else { jalert('there error updating event<br />please try again later.<br />error code: 728375', 'process error'); } $('#eventtoadd').dialog('close'); }); } } }, { text: "cancel", click: function() { $(this).dialog('close'); } }] }); }, selectable: true, selecthelper: true, select: function (start, end, allday, jsevent, view) { $("#eventtoadd").dialog( { autoopen: true, title: "create event", modal: true, buttons: [ { text:"create event", click: function () { if($('#eventtitle').val()){ calendar.fullcalendar('renderevent', { title: $('#eventtitle').val(), start: $.fullcalendar.formatdate(start, 'yyyy-mm-dd h:mm:ss tt'), end: $.fullcalendar.formatdate(end, 'yyyy-mm-dd h:mm:ss tt'), allday: allday, textcolor: $('#textcolor').val(), color: $('#backgroundcolor').val() }, true ); var startdate = $.fullcalendar.formatdate(start, 'yyyy-mm-dd h:mm:ss tt'); var enddate = $.fullcalendar.formatdate(end, 'yyyy-mm-dd h:mm:ss tt'); $.post('post.api.php', { 'api': 'createevent', 'title': $('#eventtitle').val(), 'start': startdate, 'end': enddate, 'allday': allday, 'textcolor': $('#textcolor').val(), 'bgcolor': $('#backgroundcolor').val() }, function(response) { if(response == 'success'){ jalert('the event has been saved!','event created'); } else { jalert('there error saving event<br />please try again later or let jd know<br />error code: 882293','process error'); } }); } $(this).dialog('close'); } }, { text: "cancel", click: function() { $(this).dialog('close'); } } ], close: function(){ $('#eventtitle').val(''); $('#textcolor').val(''); $('#backgroundcolor').val(''); } }); }, editable: true, events: <?= ${'events'}; ?> }); });
the record value should returned false (without quotes); not "false". had same problem , applied simple solution:
// ----------------------- while ($row = mysql_fetch_assoc($sql)) { // ----------------------- if ($row['event_allday'] = 'false') { $alldaystatus = false; } // ----------------------- $eventsarray['id'] = $row['event_id']; $eventsarray['title'] = $row['event_title']; $eventsarray['start'] = $row['event_start']; $eventsarray['end'] = $row['event_end']; $eventsarray['url'] = $row['event_url']; $eventsarray['allday'] = $alldaystatus; $eventsarray['classname'] = $row['event_class']; $eventsarray['admnotes'] = $row['event_adm_notes']; // -----------------------