पर पोस्ट विधि मैं पूर्ण कैलेंडर और MySQL का उपयोग करके एक MySQL समर्थित ईवेंट इंटरफ़ेस बनाने का प्रयास कर रहा हूं। मैंने पूर्ण कैलेंडर दस्तावेज़ में उदाहरणों का उपयोग करने की कोशिश की है और सफलतापूर्वक मेरे डेटाबेस से ईवेंट फ़ीड तैयार किया है।पूर्ण कैलेंडर कैलेंडर ईवेंट MySQL
अब मैं eventDrop
कॉल बनाने की कोशिश कर रहा हूं जो एक ईवेंट आईडी, शीर्षक और डेटाबेस के लिए प्रारंभ समय भेजता है। मैं eventDrop
कॉल बनाने के लिए पिछले एक question से कोड का इस्तेमाल किया, यहाँ पूरे Callendar पृष्ठ के लिए JavaScript है:
$(document).ready(function() {
/* initialize the external events
-----------------------------------------------------------------*/
$('#external-events div.external-event').each(function() {
// create an Event Object (http://arshaw.com/fullcalendar/docs/event_data/Event_Object/)
// it doesn't need to have a start or end
var eventObject = {
title: $.trim($(this).text()) // use the element's text as the event title
};
// store the Event Object in the DOM element so we can get to it later
$(this).data('eventObject', eventObject);
// make the event draggable using jQuery UI
$(this).draggable({
zIndex: 999,
revert: true, // will cause the event to go back to its
revertDuration: 0 // original position after the drag
});
});
/* initialize the calendar
-----------------------------------------------------------------*/
$('#calendar').fullCalendar({
header: {
left: 'prev,next today',
center: 'title',
right: 'month,agendaWeek,agendaDay'
},
editable: true,
droppable: true, // this allows things to be dropped onto the calendar !!!
drop: function(date, allDay) { // this function is called when something is dropped
// retrieve the dropped element's stored Event Object
var originalEventObject = $(this).data('eventObject');
// we need to copy it, so that multiple events don't have a reference to the same object
var copiedEventObject = $.extend({}, originalEventObject);
// assign it the date that was reported
copiedEventObject.start = date;
copiedEventObject.allDay = allDay;
// render the event on the calendar
// the last `true` argument determines if the event "sticks" (http://arshaw.com/fullcalendar/docs/event_rendering/renderEvent/)
$('#calendar').fullCalendar('renderEvent', copiedEventObject, true);
// if so, remove the element from the "Draggable Events" list
$(this).remove();
},
// events from mysql database
events: "/json-events.php",
// submit to database
eventDrop: function(calEvent, jsEvent, view) {
var method = 'POST';
var path = 'submit.php';
var params = new Array();
params['id'] = calEvent.id;
params['start'] = calEvent.start;
params['end'] = calEvent.end;
params['title'] = calEvent.title;
post_to_url(path, params, method);
}
});
});
PHP फ़ाइल मैं आशा व्यक्त की पोस्ट डेटा प्राप्त और एक अंत के साथ डेटाबेस में डालने होगा प्रारंभ समय के साथ साथ 15 मिनट (नीचे उत्तर के बाद संपादित) के बराबर समय:
<?php
mysql_connect("") or die(mysql_error());
mysql_select_db("") or die(mysql_error());
$id = $_POST["id"];
$title = $_POST["title"];
$start = $_POST["start"];
$end = date(Y-m-d T H:i:s , strtotime($start)+900);
$query = "INSERT INTO `events` VALUES (`$id`, `$title`, `$start`, `$end`, ``)";
mysql_query($query);
print $query;
?>
डेटाबेस घटना डेटा प्राप्त नहीं कर रहा है।
उत्तर के लिए धन्यवाद। मुझे लगता है कि मैं समझता हूं और अपनी सबमिट फ़ाइल को प्रत्यक्ष मानों के साथ परीक्षण करना शुरू कर दिया है और बिना किसी किस्मत वाले डेटाबेस की जांच करनी शुरू कर दी है। मैंने php फ़ाइल को बदल दिया है: '$ id = $ _POST [" id "]; $ शीर्षक = $ _POST ["शीर्षक"]; $ start = $ _POST ["प्रारंभ करें"]; $ अंत = दिनांक (वाई-एम-डी टी एच: i: एस, स्ट्रेटोटाइम ($ प्रारंभ) +900); $ क्वेरी = "घटनाओं में शामिल करें 'मूल्यों (' $ आईडी', '$ शीर्षक',' $ start', '$ end',' ')"; mysql_query ($ क्वेरी); $ $ प्रिंट करें 'यूआरएल के माध्यम से सीधे चर पारित करते समय मुझे आंतरिक सर्वर त्रुटि मिल रही है? – SlartyBartfast