I have a first table used for add/edit/delete.Next I'm trying populate a custom column not db driven, with a function that return "yes" if exist a specific row in another table (table2).
In this function, I need to use current row id so I write:
$col = array();
$col["name"] = "id_task";
$cols[] = $col;
$col = array();
$col["name"] = "custom_col";
$col……….
$col……….
$col["default"] = check_if_exist("{id_task}");
$cols[] = $col;
function check_if_exist($tskid)
{
global $g;
$check_sql = "SELECT count(*) as c from table2
WHERE table2.task_id = $tskid
AND table2.ordine_id = $myvar";
$rs = $g->get_one($check_sql);
if ($rs["c"] > 0)
return "yes";
else
return "no";
}
Naturally {id_task} in function arguments doesn't work so $tskid variable is always empty.
How can I succesfully pass current row id for my check query???
Thank You.