Passing Parameters to dataProcessor Object

Is there any way to pass parameters in the initialisation of the dataProcessor Object, for example:

dP = new dataProcessor(“mysql_connector.php?table=my_table”);

As far as I can see, the dataProcessor initialisation does not enable this, regardless of whether the POST or GET method is used.

Regards,

Richard

URL which you are providing to the constructor of dataprocessor will be preserved as is. So if you have some custom parameters - they will be included in all calls.

Beware that if you are using parameters in the URL and post mode, while data will be sent by post, you custom parameter will be sent by get

Thanks Stanislav.

I must be doing something wrong in my php code ‘mysql_connector’ - it looks like this:

<?php
require(’…/php/grid_connector.php’);
$dbname = get_config(‘dbname’,’’); //Use db name from system config file
$dbuser = get_config(‘dbuser’,’’); //Use db user name from system config file
$dbpwd = get_config(‘dbpwd’,’’); //Use db pwd from system config file
$res=mysql_connect(‘localhost’,$dbuser,$dbpwd);
mysql_select_db($dbname,$res);
$gridConn = new GridConnector($res,‘MySQL’);
//
$table = get_value(‘table’,’’);
//
$gridConn->render_table($table,“id”,“name”);
//
function get_value($param_name, $default) {
if (isset($_POST[$param_name])) {
return $_POST[$param_name];
} else {
if (isset($_GET[$param_name])) {
return $_GET[$param_name];
} else {
return $default;
}
}
}
?>

Try to use $_GET[“table”]

By the way, storing table name on client side is insecure, user can change name and access any data from DB.

Still cannot get it to work, using $_GET[“table”] - the php code does not seem to be receiving the GET parameters: the $_GET[] array is empty.

By the way, the reason I’m trying to do this is to use a single php file to handle all data requests.
Withou this, it would be necessary to generate a new php file for every table or query.

The [table] parameter is being passed as a way of doing this, but maybe there is a better - and more secure - way?

Thanks for your help,

Richard

Me too!
I use “Sending all at once” example.
dhtmlx.com/docs/products/dht … _once.html

When I use mygrid.loadXML,I am success to send parameter to the php.
mygrid.loadXML(“events01get.php?name=”+getParameter(“name”)
+"&combo1="+getParameter(“combo1”)
+"&calInput1="+getParameter(“calInput1”)
+"&time1="+getParameter(“time1”)
+"&calInput2="+getParameter(“calInput2”)
+"&time2="+getParameter(“time2”)
, function() {
mygrid.selectRow(0);
});

How can I send parameter to dataProcessor Object?

I tried to send by
myDataProcessor = new dataProcessor(“events01update.php?name=”+getParameter(“name”)
+"&combo1="+getParameter(“combo1”));

But it does NOT work…

Can you try to include the one more file on the page
dhtmlxdataprocessor_debug.js
As result you must have client side log with details about data sending.

The [table] parameter is being passed as a way of doing this, but maybe there is a better - and more secure - way?

At least check, that table value is one of allowed list, before passing it to render_table method

I tried to send by myDataProcessor = new dataProcessor("events01update.php?name="+getPa
And it must work, but beware that parameters will be set in moment of init, not in moment of data sending.
Also, some server side solution ( there are few known JAVA servers ) can ignore get parameters if POST parameters are present ( not actual for PHP )