Using treemultitable_connector cannot update the database

Hi,

I am using Multi-table tree connector to build the tree and when I update the data into database, I got the following error.

please see the connector.php switch statement case 1 , I tried with following statements and none of them are working
$tree->render_table(“ta”,“ID”,“NAME”,“”,“DISTRICT_ID”);
$tree->sql->attach(“Update”,“Update ta set NAME=‘{NAME}’ where ID={ID}”);
$tree->event->attach(“beforeUpdate”,“my_update”);

[code] [/code]

connector.php

[code]<?php
include_once(“include/library.php”);
$res=mysql_connect($dbLocalAry[‘host’],$dbLocalAry[‘user’],$dbLocalAry[‘password’]);
mysql_select_db($dbLocalAry[‘dbname’]);

require("dhtmlxconnector/treemultitable_connector.php");

$tree = new TreeMultitableConnector($res);
$tree->setMaxLevel(3);
$level = $tree->get_level();


 function my_update($data){
     $name=$data->get_value("NAME");
         $id=$data->get_value("ID");
         $tree->sql->query("UPDATE ta SET NAME='{$name}' where ID={$id}");
         $data->success(); 
  } 
 


if ($_SESSION[PREFIX.'Level']==LEVEL_DISTRICT)
	$sql="select * from district where ID=".$_SESSION[PREFIX.'DistrictID'];
else
	$sql="select * from district order by NAME ASC";

switch ($level) {
	case 0:
		$tree->render_sql($sql,"ID","NAME","","");
		break;
	case 1:
	    $tree->enable_log("temp.log",true);

		if ($tree->is_select_mode())
			$tree->render_sql("SELECT * from ta order by NAME ASC", "ID", "NAME", "", "DISTRICT_ID");
		else
			$tree->render_table("ta","ID","NAME","","DISTRICT_ID");
		//$tree->sql->attach("Update","Update ta set NAME='{NAME}' where ID={ID}");
			//$tree->event->attach("beforeUpdate","my_update");

			
		break;
	case 2:
		$tree->render_sql("SELECT * from gvh order by NAME ASC", "ID", "NAME", "", "TA_ID");
		break;
	case 3:
		$tree->render_sql("SELECT * from vh order by NAME ASC", "ID", "NAME", "", "GVH_ID");
		break;
}

?>[/code]

Hi,

the problem is confirmed. We’ll send the fix when it is ready.

Moreover, event handlers need being set before render method. In the other case it won’t be called:

$tree->event->attach(“beforeUpdate”,“my_update”);
$tree->render_table(“ta”,“ID”,“NAME”,"",“DISTRICT_ID”);

I have the same error, missing set_id and set_new_id methods in dataprocessor.php
Is there any solution already available?

Try to use the latest codebase
connector_codebase.zip (57.4 KB)