how to create an event and save into DB

Hi I am a real newbie to this scheduler component. It has all the functionality that I need but the docs for it are not written from the the point of a new user. No simple A-Z examples written out that explains everything in detail. I have looked at the sample code but it still leaves me with not understanding how to do what I currently need.

I am using PHP/mysql and figured how to load from a seeded database to the scheduler. What I want to do now is, when a user dbl clicks and saves a event to the scheduler to have it save this event to my database.

Can anyone help or point me in the direction of where I can find better docs?

Hello,

Be sure to check our simple samples. In your case you would want to check scheduler\samples\01_initialization_loading\05_loading_mysql.html
dhtmlxScheduler have dhtmlxConnectors included which make integration with database very easy.

Kind regards,
Ilya

I have seen the code but it doesn’t help. I am already doing the loading from the database successfully I want to be able to write to the database. How can I do that with the connector? Can you provide me with a simple example of how it works?

your help is much appreciated…

The sample I mentioned does save/edit/delete operations against the database.

Kind regards,
Ilya

Ok I think I understand a little more about how it all works. Here is a code snippet of what I am doing. For some reason when I click an event it is not being saved to the DB.

// Settings for the Sheduler
function init() {

		var sections=[
			          	{key:1, label:"Men's Cut"},
			          	{key:2, label:"Color"},
			          	{key:3, label:"Women's Cut"},
			          	{key:4, label:"Wax"},
			          	{key:5, label:"Child Cut (under 3 yrs old)"},
			          	{key:6, label:"Nails - Pedicure"},
			          	{key:7, label:"Nails - Manicure"},
			          	{key:8, label:"Other"}
			          ];
		
		scheduler.config.multi_day = true;
		scheduler.config.xml_date="%Y-%m-%d %H:%i";
		scheduler.config.first_hour= 9;
		scheduler.config.last_hour = 20;
		scheduler.config.hour_date="%h:%i %A";
		scheduler.config.wide_form = true;
		scheduler.config.event_duration = 30;
		scheduler.config.auto_end_date = true;
		scheduler.config.limit_time_select = true;
		scheduler.config.time_step = 30;
		scheduler.locale.labels.section_description ="Client";
					
		scheduler.config.lightbox.sections=[	
		            {name: "description", height: 20, map_to: "clientName", type: "textarea"},
		                   {name: "custom2", height: 20, map_to: "phone", type: "textarea"},
		                   {name:"custom", height:33, type:"select", options:sections, map_to:"section_id", focus:true }, 			                   {name:"time", height:72, type:"time", map_to:"start_time"}
		          ];
		                        		
		scheduler.locale.labels.section_custom="Service";			
		scheduler.locale.labels.section_custom2="Phone";	
		scheduler.init('scheduler_here',new Date(),"month");
		scheduler.setLoadMode("month");
		// Loads data from a configured database conection.
		var current_user = $('#cName').val();
		if (current_user == 'admin')
			scheduler.load("data.php?user=1000");
		else 
			scheduler.load("data.php?user="+current_user);
		var dp = new dataProcessor("data.php");
		dp.init(scheduler);
		
	
	}; // end init()

<?php include '../DHX_calendar/codebase/connector/scheduler_connector.php'; include '../DHX_calendar/codebase/connector/db_pdo.php'; include 'mysqlConnect.php'; $sched = new SchedulerConnector($database, "PDO"); $sched->enable_log("log.txt"); $sched->render_table("events","event_id","start_date,end_date,event_name,clientName,phone"); ?>

What is the content of log.txt in the problematic case?
Currently you are not providing user= for dataprocessor, be sure that you have not checks on server side which will block processing when such field do not provided.

Sorry that was old code that is all taken out. Here is the code I am using.

function init() {
var user = $(’#cName’).val();
var sections=[
{key:1, label:“Men’s Cut”},
{key:2, label:“Color”},
{key:3, label:“Women’s Cut”},
{key:4, label:“Wax”},
{key:5, label:“Child Cut (under 3 yrs old)”},
{key:6, label:“Nails - Pedicure”},
{key:7, label:“Nails - Manicure”},
{key:8, label:“Other”}
];

		if (!user.match('admin')){
			scheduler.config.limit_start = new Date();
			scheduler.config.limit_end   = new Date(2012,12,31);
			scheduler.config.limit_view  = true;
		//	scheduler.config.drag_move = false;
		} else {
			scheduler.config.limit_start = new Date(2012, 1, 1);
			scheduler.config.limit_end   = new Date(2013,1,31);
			scheduler.config.collision_limit = 2;
		}
		scheduler.config.multi_day = true;
		scheduler.config.xml_date="%Y-%m-%d %H:%i";
		scheduler.config.first_hour= 10;
		scheduler.config.last_hour = 20;
		scheduler.config.hour_date="%h:%i %A";
		scheduler.config.wide_form = true;
		scheduler.config.event_duration = 30;
		scheduler.config.auto_end_date = true;
		scheduler.config.limit_time_select = true;
		scheduler.config.time_step = 30;
		scheduler.locale.labels.section_description ="Client";
			
		//scheduler.templates.week_date_class=function(date,today){
	//		return "custom_color";	
	//	}
		scheduler.config.details_on_dblclick=true;
		scheduler.config.details_on_create=true;
		
		
		scheduler.config.lightbox.sections=[	
		                   {name: "description", height: 20, map_to: "clientName", type: "textarea"},
		                   {name: "custom2", height: 20, map_to: "phone", type: "textarea"},
		                   {name:"custom", height:33, type:"select", options:sections, map_to:"section_id", focus:true }, 			                   {name:"time", height:72, type:"time", map_to:"start_time"}
		          ];
		
		scheduler.templates.lightbox_header = function(start, end, event){
			return event.text;
		}
		scheduler.locale.labels.section_custom="Service";			
		scheduler.locale.labels.section_custom2="Phone";	
		scheduler.blockTime(0, "fullday");
		scheduler.blockTime(1, "fullday");
		
		scheduler.attachEvent("onEventCollision", function (event_id){
			if (!user.match('admin')) 
				alert("Sorry, I'm Booked at that Time");
			else 
				alert("A Client is already booked at that time");
		    deleteEvent(scheduler.getEvent(event_id));
		  });
		
		
		
		scheduler.init('scheduler_here',new Date(),"month");
		scheduler.setLoadMode("month");
		
		// Loads data from a configured database conection.
		scheduler.load("data.php");
		
		var dp = new dataProcessor("data.php");
		dp.init(scheduler);
		
	}; // end init()

my log file

====================================
Log started, 23/04/2012 08:04:44

SELECT event_id,start_date,end_date,event_name,clientName,phone FROM events

Done in 0.018584966659546s

Thanks for your help I realized that it was that my DB setting for event_id was only for an int of 11 characters and my ids were much bigger. Failing the insertion.

thanks…