Problem with complex insert/update

Hi,
since a couple of days I’m trying to solve this issue without luck.
I got a dhtmlxconnector which visualize information from two tables, but I’d like to update only one (if possible with an advanced update that also insert the record if not available).

My grid connector code is the following:

<?php 

require_once("library/connector/grid_connector.php");// includes the appropriate connector 

function my_update($data){
    global $conn;
    global $id_proj;
    $id = $data->get_value("id");
    $value = $data->get_value("Sol_1");
    LogMaster::log("id:". $id);
    LogMaster::log("value:". $value);
    $conn->sql->query("insert into evaluation_data (id_proj, id_eval, value) values('{$id_proj}', '{$id}', '{$value}') on duplicate key update id_proj=values('{$id_proj}'), id_eval=values('{$id}'), value=values('{$value}')");
    $data->success();
} 
$id_proj = $_GET['id_proj'];
$res = mysql_connect("localhost","root","****");//connects to a server that contains the desired DB
mysql_select_db("ba");// connects to the DB. 'tasks' is the name of our DB
$conn = new GridConnector($res,"MySQL");// connector initialization 
$conn->enable_log("./logger_gridconnector.txt"); 
$conn->sql->attach("Update","my_update");

if ($conn->is_select_mode())//code for loading data
    $conn->render_sql("SELECT evaluation.id AS id,evaluation.dim AS dim,evaluation.title AS title,evaluation_data.value AS Sol_1 FROM evaluation LEFT JOIN evaluation_data ON evaluation.id=evaluation_data.id_eval", "a.id","id,dim,title,Sol_1");
else //code for other operations - i.e. update/insert/delete
    $conn->render_table("evaluation_data","id","id,id_proj,id_eval,value"); 

?>[/code]

Data loading works very well... but I've no clue on the upload side. The logger shows this: 

[code]====================================
Log started, 17/01/2014 05:01:39
====================================

DataProcessor object initialized
1389974561x2_gr_id => 1389974561x2
1389974561x2_c0 => 14
1389974561x2_c1 => Technology
1389974561x2_c2 => Technological Barriers
1389974561x2_c3 => 5
1389974561x2_!nativeeditor_status => updated
ids => 1389974561x2

Row data [1389974561x2]
id => 14
id_proj => Technology
id_eval => Technological Barriers
value => 5
!nativeeditor_status => updated

my_update

exception 'Exception' with message 'MySQL operation failed
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'my_update' at line 1' in C:\Documents and Settings\francesco.boano\Documenti\wip\NetBeansProjects\DAPP_BOA\public_html\library\connector\db_common.php:965
Stack trace:
#0 C:\Documents and Settings\francesco.boano\Documenti\wip\NetBeansProjects\DAPP_BOA\public_html\library\connector\dataprocessor.php(210): MySQLDBDataWrapper->query('my_update')
#1 C:\Documents and Settings\francesco.boano\Documenti\wip\NetBeansProjects\DAPP_BOA\public_html\library\connector\dataprocessor.php(173): DataProcessor->check_exts(Object(DataAction), 'update')
#2 C:\Documents and Settings\francesco.boano\Documenti\wip\NetBeansProjects\DAPP_BOA\public_html\library\connector\dataprocessor.php(102): DataProcessor->inner_process(Object(DataAction))
#3 C:\Documents and Settings\francesco.boano\Documenti\wip\NetBeansProjects\DAPP_BOA\public_html\library\connector\base_connector.php(475): DataProcessor->process(Object(DataConfig), Object(DataRequestConfig))
#4 C:\Documents and Settings\francesco.boano\Documenti\wip\NetBeansProjects\DAPP_BOA\public_html\library\connector\base_connector.php(398): Connector->render()
#5 C:\Documents and Settings\francesco.boano\Documenti\wip\NetBeansProjects\DAPP_BOA\public_html\grid_connector.php(28): Connector->render_table('evaluation_data', 'id', 'id,id_proj,id_e...')
#6 {main}

Edit operation finished
0 => action:error; sid:1389974561x2; tid:1389974561x2;

Done in 0.031247854232788s

the info:

id => 14 id_proj => Technology id_eval => Technological Barriers value => 5

Seems referring to the table “evaluation”, but is trying to update “evaluation_data”

any clue ?

You are mixing two different features - custom sql strings and server side events.
Syntax which you are using is purposed to define custom string, not custom code. If you need to have a custom code run for update operation, you need to replace

$conn->sql->attach("Update","my_update");

with

$conn->event->attach("beforeUpdate","my_update");

Got couple of new problems, but the connector issue is solved! Thanks