| Issue 98: | How to integrate the Full Calendar with mysql Database | |
| 7 people starred this issue and may be notified of changes. | Back to list |
Dear all, I had a problem to integrate the FullCalendar with mysql Database. Can anyone explain how to do it??? Urgent!!!
Sep 15, 2009
#1
omri.ro...@gmail.com
Sep 22, 2009
Indeed, see the json.html example.
Sep 25, 2009
I also have some aspects of this I don't yet understand. Using the JSON example, I've already made something that displays events listed in a database via a call to a PHP script that outputs the JSON. But right now, the PHP script outputs the full range of entries in the database, and obviously it would be more efficient if I displayed just the entries that are needed for display. I'm displaying month view, and as I go forward or backwards a month, the call it makes to the PHP script include things like this: &start=1254027600&end=1257660000&_=1253910247531 I don't understand what purpose does the _ parameter serve? And what date format are the start and end parameters?
Sep 28, 2009
tarstarkas... it is all described in the docs (http://arshaw.com/fullcalendar/docs/events-and-sources.php)
Nov 3, 2009
I have the same problem as sygluvhny03,
Actually I really want to integrate fullcalendar into my website very much. But i
don't know how to handle the events(display, add, edit, delete). Can anyone give me
some guidance and correct my code please?
calendar.php:
$(document).ready(function() {
var date = new Date();
var d = date.getDate();
var m = date.getMonth();
var y = date.getFullYear();
$('#calendar').fullCalendar({
theme: true,
draggable: true,
header: {
left: 'prev,next today',
center: 'title',
right: 'month,agendaWeek,agendaDay'
},
editable: true,
events: "json_events.php",
});
});
</script>
<style type='text/css'>
body {
margin-top: 40px;
text-align: center;
font-size: 13px;
font-family: "Lucida Grande",Helvetica,Arial,Verdana,sans-serif;
}
#calendar {
width: 900px;
margin: 0 auto;
}
</style>
</head>
<body>
<div id='calendar'></div>
</body>
</html>
json_events.php:
<?php
require("../../../connect/config.php");
$link = mysql_connect("$server","$user","$password") or die(mysql_error());
mysql_select_db($db);
$query = "SELECT id,title,start, end FROM events";
$result = mysql_query($query) or die(mysql_error());
$arr = array();
while($row = mysql_fetch_assoc($result)){
$arr[] = $row;
}
echo json_encode($arr);
?>
Thanks so... much.
Nov 9, 2009
1. Add the links on top of the calendar by: <div id='calendar'><div align="right">[Add] [Edit] [Remove]</div></div> The link should be like this "super_calendar_admin.php?year=2009&month=12" 2. Install the Free Super AJAX Calendar: http://www.bmgadg.com/super_ajax_calendar.php import the super_calendar.sql to MySQL 3. Modify super_calendar_admin.php to [Add] [Edit] [Remove] events then make sure json_events.php can read the array from MySQL. ** must comment this line //if(!checkUser()) doAuth(); 4. Use the drop down event "eventDrop: function(event, delta)" to update the dynamic change in MySQL by sumbit the link like this index.php? id=111&start=1254027600&end=1257660000&_=1253910247531 5. Finish
Nov 9, 2009
One more thing, you may also call the function "fullCalendar(‘clientEvents’)" to obtain all the event changed by user. then export the array to MySQL.
Nov 27, 2009
(No comment was entered for this change.)
Status:
Duplicate
Labels: -Type-Defect -Priority-Medium Type-Enhancement Mergedinto: 214
Feb 22, 2010
i have problem to create a calendar use php language? any one know how to create a calendar like zk calender use the php language??? i hearing from yours???
Jun 17, 2010
I have a problem, not to update the events in the MySql database when I do eventDrop: function (event, delta). Not whether to invoke a php created or how.
Dec 22, 2010
Hi, I've put a completely fullcalendar with php and mysql example at http://www.sokati.com/main/openSource , it should get everyone started who has similar problems. Best!, Niels
Feb 11, 2011
Hi, i have download and install the calendar at http://www.sokati.com/main/openSource. it working on the local host but it not working on the network. it does not render event on the calendar.
Oct 13, 2011
Hi, I used the wai.chi.hang.eric@gmail.com solution has helped me. I post my code in case it is of your interest.
I adapted the Hours in 24h format and include the eventClick.
-------------------------------------
json.html (include this script)
<script type="text/javascript">
$(document).ready(function() {
var date = new Date();
var d = date.getDate();
var m = date.getMonth();
var y = date.getFullYear();
$('#calendar').fullCalendar({
theme: true,
draggable: true,
header: {
left: 'month, agendaWeek',
center: 'title',
right: 'today, prev,next'
},
editable: false,
allDayDefault: false,
url: true,
timeFormat: 'HH:mm ', // uppercase H for 24-hour clock
agenda: 'HH:mm ', // 5:00 - 6:30
events: "json-events.php",
eventDrop: function(event, delta) {
alert(event.title + ' ha sido movido ' + delta + ' dias\n' + '(should probably update your database)');
},
loading: function(bool) {
if (bool) $('#loading').show();
else $('#loading').hide();
},
eventClick: function(calEvent, jsEvent, view) {
//alert('Event: ' + calEvent.title);
//alert('Url: ' + calEvent.url);
//alert('View: ' + view.name);
window.open(calEvent.url, blank);
return false;
}
});
});
</script>
-------------------------------------
json_events.php
<?
require("login/common.php");
$link = mysql_connect("$database_host","$database_user","$database_pass") or die(mysql_error());
mysql_select_db($database_name);
$query = "SELECT id,title,start, DATE_FORMAT(start, '%Y-%m-%d %H:%i' ) AS startDate, end, url FROM events ORDER BY startDate DESC";
$result = mysql_query($query) or die(mysql_error());
$arr = array();
while($row = mysql_fetch_assoc($result)){
$arr[] = $row;
}
echo json_encode($arr);
?>
thank´s u wai.chi.hang.eric@gmail.com !
Jun 7, 2012
I still don't understand how to integrate jquery fullcalendar to my database in mysql. can you please share your script with your XXX.sql, from there I can learn more. please help me. thanks before sorry if my english is not good.
Dec 2, 2012
It works!
Please notice a PHP variable ($events) at the end of the code:
var calendar = $('#calendar').fullCalendar({
header: {
left: 'prev,next today',
center: 'title',
right: 'month,agendaWeek,agendaDay'
},
selectable: true,
selectHelper: true,
select: function(start, end, allDay) {
show_event_info(start);
},
eventClick: function(calEvent, jsEvent, view) {
edit_event(calEvent.id);
},
editable: true,
events: <?php echo $events;?>
});
Feb 26, 2013
i want the same code in jsp instead of php please send the code to divyavimalabai@gmail.com
Mar 14, 2013
if any one has jsp code please send at anshulankush@gmail.com
May 7, 2013
you can find an example here: http://jamelbaz.com/tutos/integration-de-fullcalendar-avec-php-mysql . The tutorial is in french
Sep 11, 2013
Thnaks dude it is working
Jan 25, 2014
i want the same code in jsp instead of php please send the code to E-mail : ic.bluesky.us@gmail.com |
|
| ► Sign in to add a comment |