My favorites | Sign in
Project Home Issues
New issue   Search
for
  Advanced search   Search tips   Subscriptions
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
Status:  Duplicate
Merged:  issue 214
Owner:  ----
Closed:  Nov 2009


Sign in to add a comment
 
Reported by sygluvhn...@gmail.com, Sep 15, 2009
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
Well,

If I get what you're saying....
Full calendar is using javascript, run solely on browsers, I believe you're after an
application run locally, not on web.

What you can do is:
1. build a web application that uses mysql
2. run the application on a web server
3. write the javascript to submit requests to the web server thruogh a browser.
4. hand the results to fullcalendar.

or, in place of 3&4 - use JSON.

Hope it helped...
Sep 22, 2009
#2 impresst...@gmail.com
Indeed, see the json.html example.
Sep 25, 2009
#3 tarstark...@gmail.com
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
Project Member #4 adamrs...@gmail.com
tarstarkas... it is all described in the docs 
(http://arshaw.com/fullcalendar/docs/events-and-sources.php)
Nov 3, 2009
#5 soleilch...@gmail.com
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
#6 wai.chi....@gmail.com
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
#7 wai.chi....@gmail.com
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
Project Member #8 adamrs...@gmail.com
(No comment was entered for this change.)
Status: Duplicate
Labels: -Type-Defect -Priority-Medium Type-Enhancement
Mergedinto: 214
Feb 22, 2010
#9 telestom...@gmail.com
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
#10 mparr...@gmail.com
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
#11 nielsba...@gmail.com
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
#12 olanrewa...@gmail.com
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
#13 i...@crissrocca.com
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
#15 gasta.pr...@gmail.com
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
#16 amir.aak...@gmail.com
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
#17 divyavim...@gmail.com
i want the same code in jsp instead of php please send the code to divyavimalabai@gmail.com
Mar 14, 2013
#18 ans...@tachsec.com
if any one has jsp code please send at anshulankush@gmail.com

May 7, 2013
#19 zascar.a...@gmail.com
you can find an example here: http://jamelbaz.com/tutos/integration-de-fullcalendar-avec-php-mysql . The tutorial is in french

Sep 11, 2013
#20 bestmvpa...@gmail.com
Thnaks dude it is working
Jan 25, 2014
#21 Sompong....@gmail.com
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

Powered by Google Project Hosting