| Issue 851: | My entries are all allday events | |
| 1 person starred this issue and may be notified of changes. | Back to list |
I'm really new to fullcalendar and I am working to get calendar's events from a mysqldb.
With my json-event.php:
mysql_select_db($database_connect, $connect);
$query = "SELECT id,title,start,end,url FROM events";
$result = mysql_query($query) or die(mysql_error());
$arr = array();
while($row = mysql_fetch_assoc($result)){
$arr[] = $row;
}
echo json_encode($arr);
i get the following answer:
[{"id":"3","title":"Test","start":"2011-03-18 00:00:00","end":"2011-03-18 11:00:00","url":"http:\/\/google.de"}]
And thats displayed as an allday event? What I'm doing wrong?
Mar 21, 2011
Project Member
#1
althaus.it
Mar 24, 2011
yeah, we would need a real demo to see what's going wrong
Status:
Reproducing
Apr 9, 2011
I have it online now: sorry for my delay: http://itandmoredev.de/fc/demos/theme.html Thx for your help
Apr 9, 2011
Hi gevestbe, i want to know is u r using mysql statement with where clause...? i m also working on mysql statement with full calender but i dont know what i m making mistake i m not getting data rendered... if u r using where statement please let me know... so i will provide my code to you for test it... thank you waiting for ur reply... sagar
Apr 9, 2011
hi at the moment i use simply this statement: $query = "SELECT id,title,start,end,url FROM events"; but later i need also where clauses and i will also have more selected fields. Sincerly, Stefan
Apr 10, 2011
Thank you buddy for reply.... i m posting which code i have used... i dont know if i m creating mistake some where but my code is able to render output but is not able to display events on calender...
Here is my code which i m using... i dont know exactly what is wrong...
<script type='text/javascript'>
$(document).ready(function() {
$('#calendar').fullCalendar({
header: {
left: 'prev,next today',
center: 'title',
right: 'month,agendaWeek,agendaDay'
},
editable: true,
events:
<?php
$myID = $_SESSION['MM_Username'];
echo "[";
$query_EventStr = "SELECT * FROM eventcalender WHERE username = 'admin'";
mysql_select_db($database_activity, $activity);
$EventStr = mysql_query($query_EventStr) or die(mysql_error());
$row_EventStr = mysql_fetch_assoc($EventStr);
$events = "";
do {
$events .= "{";
$events .= "id:'".$row_EventStr['id']."',";
$events .= "title:'".$row_EventStr['title']."',";
$events .= "start:'".$row_EventStr['start']."',";
$events .= "end:'".$row_EventStr['end']."', ";
$events .= "allDay: false,";
//$events .= "url:'".$row_EventStr['url']."',";
$date_fix=date("F j, Y,TT g:i a",strtotime($row_EventStr['start']));
$events.= "},";
} while ($row_EventStr = mysql_fetch_assoc($EventStr));
mysql_free_result($EventStr);
$EventStr = null;
$events = trim($events, ",");
//echo json_encode($events);
echo $events;
echo "],";
?>
timeFormat: 'h(:mm)tt',
eventClick: function(calEvent, jsEvent, view) {window.location = "update.php?id="+calEvent.id}
});
});
</script>
and this is output generated by above code
events:
[{id:'10259',title:'test time',start:'2011-05-10 08:21:00',end:'2011-05-10 10:27:00', allDay: false,}],timeFormat: 'h(:mm)tt',
eventClick: function(calEvent, jsEvent, view) {window.location = "update.php?id="+calEvent.id}
});
Any help will be appreciated if possible will you please test your code with where statement and see if it is listing data from database and showing it on page?
Thank you again...
Apr 15, 2011
Sorry sagarne...@gmail.com, but we cannot help you on your data source related code. If you have a problem with the calendar rendering, please provide a working copy of your code online or as a zip.
Apr 15, 2011
You need to make sure the date that you are fetching is comming back properly. i had a similar issue because it was not serialised properly and was missing a character.. caused me a day of headache
2011-03-18 11:00:00 there should be a T in there? or something
Here is a sample of my data from several combined feeds that i serialise back to the fullcalendar
[{"title":"Comp Medal","start":"2011-04-01T07:20:00","end":"2011-04-01T08:50:00","allDay":false,"groupsize":"","className":"data-brs clickable","cache":null,"description":null,"EventCompTypeMSP":null,"CompTypeMSP":null,"CompQualifierYN":null,"color":null,"CompCourseName":null,"CompNumberDivs":null,"CompQualifierYN1":null,"CompNumber":null},{"title":"Club Game","start":"2011-04-01T13:20:00","end":"2011-04-01T14:30:00","allDay":false,"groupsize":"","className":"data-brs clickable","cache":null,"description":null,"EventCompTypeMSP":null,"CompTypeMSP":null,"CompQualifierYN":null,"color":null,"CompCourseName":null,"CompNumberDivs":null,"CompQualifierYN1":null,"CompNumber":null},{"title":"S Barratt","start":"2011-04-04T08:20:00","end":"2011-04-04T08:20:00","allDay":false,"groupsize":"1","className":"data-brs clickable","cache":null,"description":null,"EventCompTypeMSP":null,"CompTypeMSP":null,"CompQualifierYN":null,"color":null,"CompCourseName ...>>etc
Apr 15, 2011
Oh and my allDay setting is set to false.
Any all day entries i need include an {"allDay":true } in the json returned. Remember true is a value not a string!
May 8, 2011
@gevestbe you need to set allDay:false in every event
Status:
Done
|
|
| ► Sign in to add a comment |