Load from two different mysql tables

I am trying to render a calendar from two data sources, each a mysql table within same DB. I am using the dataProcessor component and I can get each of the data sources to load individually, but when I try both, the loading image pops but no data loads, and loading image just cycles. I have included the codebase/ext/dhtmlxscheduler_multisource.js in the page head. Here is the pertinent code:


		var dp = new dataProcessor("task_events.php");
		var dp2 = new dataProcessor("events.php");

I had tried using just one instance of dataProcessor, with same results (stuck loading).

Both of the php files in the load statement render xml that looks fine. Those files contain:




The log file shows that only the data from the first loaded url (task_events.php), so I gather I’ve missed something on how to load multiple sources, but have scoured the forum and docs and can’t find it. I will greatly appreciate any help.

In case of multiple resources you use pass array to the load method:


Thank you - that definitely solved the loading problem. I am still unable to figure out how to get the dataProcessor to update both data sources. I have tried using a separate instance of dataProcessor, but I don’t know how to bind or relate that instance to each respective set of events. When using this code, only the first instance updates records:

var dp = new dataProcessor("task_events.php");

The events associated with the second instance update in browser but are not saved to DB:

var dp2 = new dataProcessor("events.php");

I have tried several variations, but I am afraid I am missing something?

I found my error - a typo in the events.php file. So it’s working now.
Many thanks for your help and your impressive software!

Is there a recommended solution for saving a new event to either db table based on the value of an event property? As of now, new events are saved to the second table loaded (dp2), but in some cases I need the event saved to the first table (dp).

I need to amend my last post - it does not seem that it always updates the second table when new events are added. I am not sure if there is a pattern, but I still need a solution to this problem.

While scheduler can be loaded from multiple sources, only one instance of dataprocessor can be used, which normally means - all changes will be routed to single php script.

You can set check inside such single php file, and based on incoming params ( some property of event ) initiate related connector.


What you are saying is that we have to do some kind of checking if the action came from a event_A or event_B?

It´s something like that?
Client Side:


Server side:

$scheduler = new schedulerConnector($res);
if($newProperty =='event'){ //$newProperty carries the 'type' field value from one of the rendered tables

Yes for data saving you can use the approach similar to the described one.

Dataprocessor can point only to single url, and inside that file you need to init only one connector, based on some settings. The problem is that properties of event are encoded in POST request, and there is no stable way to check it before initializing connector. Assuming that you will use scheduler in default data saving mode , the next can be used

$id = $_POST[“ids”]; //may be wrong, if you are using non-default data sending mode

where “propertyname” - name of property

If you are using some custom settings of dataprocessor , the encoding of parameters may change


I’ve made all that you suggested, and it´s working fine (fetches, deletes, inserts and updates).
But now I’m facing a loading problem. Some events doesn’t load, and when I refresh the scheduler, these events appears and other ones desapears. Refresh again and all events are showed, new refresh, its desapears again…

The appearing/desappearing is random, dont follow a sequence…
What could be happening?

Can be caused by non-unique IDs
While you can load data from multiple tables - ID of each event must be unique for both tables.

That´s it!!
I stop to use the autoincrement table field for the ID. Change it to the event_id now.
Problem solved!

Thanks again!!