I am new to use dhtmlx scheduler. I want to use shared events with location data also. But i can't able to do, below is my serv
<?php
require_once('../common/connector/scheduler_connector.php');
require_once('../common/config.php');
$user_id = intval($_GET['user']);
$location_id = 11;
$scheduler = new schedulerConnector($res, $dbtype);
function default_values($action){
global $user_id;
$event_type = $action->get_value("event_type");
if ($event_type == "")
$event_type = 0;
$action->set_value("userId",$user_id);
$action->set_value("locationId", $location_id");
}
$scheduler->event->attach("beforeProcessing","default_values");
$scheduler->render_sql("select * from events_shared where userId = ".$user_id,"event_id","start_date,end_date,text,event_type,userId");
?>
$action->set_value("locationId", $location_id"); is the only line I added to the existing sample code, which I got from the official site. I added a column in the events_shared table also.
You need to import '$location_id' into 'function default_values' scope using a 'global' keyword:
Secondly, you seem to have unclosed quote after $location_id. It should give you a syntax error:
If you want to do the filtering by 'userId' column, you can use built-in api for filtering or escape the request before inserting them into sql query. Otherwise your queries are exposed to sql injections. Unsafe implementation:
Safe implementation:
This code probably should work: