SQL Inserts and Reads

Hi,

I am using connector (for DataView) to render_sql and also to update (insert actually) items into the DataView. In the below code - which works fine the way it is but I either need a way to determine that we are currently in read mode (and therefore not execute the render statement) or a way to get at the project number which is passed in by dataProcessor on adding a new item to the DataView:

[code]$data = new DataViewConnector($conn);

$data->sql->attach(“Insert”,“INSERT INTO tasks2 (name,description,created,project,owner,originator) VALUES (‘{name}’,‘{description}’,‘{created}’,{project},{owner},{originator})”);

$data->render_sql(“SELECT name,description,created,project,owner,originator,taskid FROM tasks2 WHERE owner=1 AND project=2” ,‘taskid’, ‘name,description,created,project,owner,originator,taskid’); //<-- Cannot get project via {project} as above…[/code]

As you can see I have hard-coded for testing at project=2.

Thanks in advance,

Steve

Hi

As you have a custom insert handler, the code in render_sql will not be used for data saving ( data inserting )

In common case, you can use $data->is_select_mode() to separate data saving and data loading logic.

docs.dhtmlx.com/connector__php__ … selectmode