dhtmlxConnector can update / inserts but not both?

In short dhtmlxConnector with dhtmlxtree. i am able to retrieve valid xml data with the following code.

$tree = new TreeConnector($res); $tree->render_sql("SELECT id,name from devices WHERE production = '{$production}' ORDER BY name desc","id","name","","parent_id");

But with the above i am only able to update item names and not the parent_id’s as shown below.

[code]DataProcessor object initialized
101_tr_id => 101
101_tr_pid => 2347
101_tr_order => 6
101_tr_text => VMPWDB01
101_!nativeeditor_status => updated
ids => 101

Row data [101]
tr_id => 101
parent_id => 2347
tr_order => 6
name => VMPWDB01
!nativeeditor_status => updated

UPDATE devices SET name=‘VMPWDB01’ WHERE id=‘101’ AND ( production = ‘1’)
[/code]

if i change the code to this

$tree = new TreeConnector($res); $tree->render_sql("SELECT id,name from devices WHERE production = '{$production}' ORDER BY name desc","id","name,parent_id","","parent_id");

i’m able to update the parent_id of the node but not able to create new nodes.

[code]====================================
Log started, 09/02/2010 08:02:06

DataProcessor object initialized
101_tr_id => 101
101_tr_pid => 2347
101_tr_order => 6
101_tr_text => VMPWDB01
101_!nativeeditor_status => updated
ids => 101

Row data [101]
tr_id => 101
parent_id => 2347
tr_order => 6
name => VMPWDB01
!nativeeditor_status => updated

UPDATE devices SET name=‘VMPWDB01’,parent_id=‘2347’ WHERE id=‘101’ AND ( production = ‘1’)

Edit operation finished
0 => action:updated; sid:101; tid:101;

Done in 0.0020639896392822s

====================================
Log started, 09/02/2010 08:02:08

DataProcessor object initialized
1265766366767_tr_id => 1265766366767
1265766366767_tr_pid => 101
1265766366767_tr_order => 0
1265766366767_tr_text => item
1265766366767_!nativeeditor_status => inserted
ids => 1265766366767

Row data [1265766366767]
tr_id => 1265766366767
parent_id => 101
tr_order => 0
name => item
!nativeeditor_status => inserted

INSERT INTO devices(name,parent_id,parent_id) VALUES (‘item’,‘101’,‘101’)

Edit operation finished
0 => action:error; sid:1265766366767; tid:1265766366767;
[/code]

What could i be missing that would make one 1 of the 2 work at any given time?
Also this is the same result i get even when using the supplied connector tree sample.

The first render_sql command looks correct except parent_id isn’t selected initially:

$tree->render_sql(“SELECT id,name,parent_id from devices WHERE production = ‘{$production}’ ORDER BY name desc”,“id”,“name”,“”,“parent_id”);

The 3rd parameter can contain only item text. So, $tree->render_sql(“SELECT id,name from devices WHERE production = ‘{$production}’ ORDER BY name desc”,“id”,“name,parent_id”,“”,“parent_id”); isn’t correct.

But there was a problem with parent id update. I’ve attached the fixed files. Try to use them instead of originals.
tree_connector.zip (2.46 KB)
db_common.zip (5.78 KB)
base_connector.zip (3.89 KB)

works perfectly!
Should push to the sample connector code also.

Big thanks!