Hi,
I have cruised the forum but couldn’t seem to find anything about this. I downloaded the mobile scheduler package and was playing with it, but when I wanted to get to the php connector part to work with databases, if I load sample 01_basic/05_data_saving.html or 03_offline/01_offline.html nothing loads and my firebug gives me the following error:
SyntaxError: syntax error
dhx.temp=<?php
dhxsch…bile.js (line 85, col 9)
Any advice?
Kind regards,
Elie
Hi,
Please check that you set a correct data driver in load() method. It should be “scheduler”, because schedulerConnector requires specific xml format:
$$(“scheduler”).load(url,“scheduler”);
The untouched samples use “json”:
$$(“scheduler”).load(“data/events.php”,“json”);
I changed it to “scheduler” instead and no longer get the syntax error, however it is not loading any event. Untouched sample events.php is as follow:
<?php
include ('../../../connectors/data_connector.php');
include('../../../connectors/db_sqlite.php');
include ('../../common/config.php');
if (!$res = sqlite_open('../../common/db', 0777, $sqliteerror)) {
die($sqliteerror);
}
$scheduler = new JSONDataConnector($res,"SQLite");
$scheduler->render_table("events","event_id","start_date,end_date,event_name (text),details");
?>
All referenced files are in the right location, I extracted the entire mobile scheduler package without touching or moving anything around.
Yes, in case of JSONDataConnector you should use “json” data driver.
Make sure that your php supports sqlite (sqlite extension is set). You can use another database Instead of sqlite, MySQL for example. Please see connector documentation for more details:
docs.dhtmlx.com/doku.php?id=dhtmlxconnector:init
I must be missing something, but I can’t put my finger on it… The following code does not return any error or event while the table is populated.
Connector call in the main page:
$$(“scheduler”).load(“data/connector.php”,“scheduler”);
Connector code:
<?php
require("../../../connectors/scheduler_connector.php");
$res=mysql_connect("localhost","root","");
mysql_select_db("scheduler");
$scheduler = new SchedulerConnector($res,"MySQL");
$scheduler->render_table("events","event_id","start_date,end_date,event_name,details");
?>
I checked and confirm the spelling of database “scheduler” and the table “events” if of the following structure:
event_id | event_name | start_date | end_date | details
Frustrating part is I’m sure I am missing something obvious…
Hello,
Code you are using looks correct. Try to enable error log to get details about the issue:
$scheduler = new SchedulerConnector($res,“MySQL”);
$scheduler->enable_log(“log.txt”,true);
$scheduler->render_table(“events”,“event_id”,“start_date,end_date,event_name,details”);
Also it is possible that connector.php returns correct result, and you have not specified init_date in scheduler configuration:
scheduler.config.init_date = new Date(2009,4,1);
Sorry for the late reply, thanks for the answer it worked.
I actually noticed on this computer my browser was by default opening the files in local full path (C:\folder…\file.html) rather than opening it as a localhost webpage (http:// localhost/file.html) so the PHP code was not executing and retrieving the data.
Kind regards,
Elie