How would I load events where Company_ID = $cid.
this is what I have so far but it dosent work:
$schedulerConn = new schedulerConnector($res, MYSQLi);
$cid= $_GET['cid'];
$schedulerConn->render_table("events","id"," start_date, end_date, text, details, rec_type, event_length, event_pid, Company_ID");
$schedulerConn->render_sql("select * from events where Company_ID = $cid")
I really still do not understand what to do, that article was confusing and I dont think that’s what i’m looking for
Hello,
try to attach server side filter as it done in the very first code example in the article:
[code]$schedulerConn = new schedulerConnector($res, MYSQLi);
if(isset($_GET[‘cid’])){
$cid = $_GET[‘cid’];
$schedulerConn->filter(“Company_ID”, $cid);//connector->filter(columnName, value)
}
$schedulerConn->render_table(“events”,“id”," start_date, end_date, text, details, rec_type, event_length, event_pid, Company_ID");[/code]
Thanks for response!!
Okay, so i’ve tried this code
if(isset($_GET['cid'])){
$cid = $_GET['cid'];
$schedulerConn->filter("Company_ID", $cid);//connector->filter(columnName, value)
}
$schedulerConn->render_sql("SELECT * from events WHERE Company_ID = $cid","id"," start_date, end_date, text, details, rec_type, event_length, event_pid, Company_ID");
And it strangely filters the events that are not equal to $cid, so my Company_ID= 4, and $cid =4. and It brings back the events with Company_ID= 0, filtering out the ones i want displayed.
Am i doing it right?
THANKS in advaced
Hello,
try to remove ‘WHERE’ statement from the ‘render_sql’ call. Putting company id from a variable there provides an entry point for sql injections, and also duplicate job that supposed to be done by filter.
The general way connector works - it tries to parse sql statement or table declaration that you pass to render_table or render_sql method. If it succeed, connector is able to generate update/delete/insert queries on its basis, and also generate a proper request regarding all attached filters.
Try to use this exact code(if it’s correct with your tables).
Changes comparing to yours :
- I’ve replaced render_sql with render_table, to make sure connector could generate proper sql queries
- remove whitespaces from columns list, maybe they was causing the issue
[code]$schedulerConn = new schedulerConnector($res, MYSQLi);
if(isset($_GET[‘cid’])){
$cid = $_GET[‘cid’];
$schedulerConn->filter(“Company_ID”, $cid);
}
$schedulerConn->render_table(“events”,“id”,“start_date,end_date,text,details,rec_type,event_length,event_pid,Company_ID”);[/code]
when I try that exact code it dosent filter the events, everything in the database is displayed back.
Is anyone familiar with this, I tried a lot of things but it doesn’t work.
Please enable the server side logs and provide the log content for the problematic scenario.
docs.dhtmlx.com/doku.php?id=dhtm … tor:errors