I’ve set up the example found here:
docs.dhtmlx.com/doku.php?id=tuto … m_fullcode
and have it working fine. However, my form will never be preloaded, so I removed the .load calls.
In the PHP, I want to be able to do a specific insert statment, rather than use the render_table method.
I’ve tried using the render_sql statement, but with no luck. Can anybody provide an example of how I would do the exact same action (aka save name, address, and email in the DB) using the render_sql statment? I know it’s not much use in this instance, but it would help me figure out some things.
Thanks!
In the PHP, I want to be able to do a specific insert statment, rather than use the render_table method.
Check
docs.dhtmlx.com/doku.php?id=dhtm … ex_updates
There are two way
a) attach custom sql code to operation
$conn->sql->attach(“Insert”, " sql code here")
b) use event
function mycode($action){
$some = $action->get_value("field_name");
.. exec custom saving logic here ...
$action->success();
}
$conn->event->attach("beforeInsert", "mycode")
So in the above mentioned example, using the first method you mentioned:
the line
$conn->render_table(“customers”,“id”,“name, address, email”);
could be replaced with
$conn->sql->attach(“Insert”,"INSERT INTO customers VALUES(’{name}’,’{address}’,’{email}’) ");
$conn->render_sql(" … ",“name”,“address,email”);
?
Or is just the first line needed?
Alternatively (I’d really like to know, the guy i’m working with is all about them), how would I call a stored procedure using DHTMLX’s scheme? Would this be using render_sql or also something like the sql->attach?
Thanks again!
You can use
$conn->sql->attach(“Insert”,"INSERT INTO customers VALUES(’{name}’,’{address}’,’{email}’) ");
$conn->render_table(“customers”,“id”,“name, address, email”);
Which means - for all operations except of insertion render_table configuration will be used, for insertion - defined sql will be executed.
Would this be using render_sql or also something like the sql->attach?
If you need to use them for saving - you can use sql->attach, if you need them for data loading - in current version of connectors it will not work, but we already have a version which allows to use stored procedure as source of data.