I have found so many thread that are discussing about multiple table update while using View/Custom View.
i wrote a small function to update my view and custom view
$tablearray=array('table1','table2','table3',.........);
$rsnew is the array in the Row_Updating Server Event (see Server Events and Client Scripts in the help file)
$where is the where clause of the sql to update to a particular record only.
function my_MulitUpdate($tablearray, $rsnew, $where){
foreach($tablearray as $table){
$rsnew1 = array();
$table1 = ew_Execute("SELECT COLUMN_NAME FROM information_schema.columns WHERE table_name = '".$table."'");
while(!$table1->EOF){
$column = $table1->fields('COLUMN_NAME');
if(array_key_exists($column,$rsnew)){
$rsnew1[$column] = $rsnew[$column];
}
$table1->MoveNext();
}
$table1->close();
$classname = "c".$table;
$updatetable = new $classname();
$updatetable->update($rsnew1,$where);
}
}
The one disadvantage of this function is we have to generate the table code once while generating the project. otherwise the code
$updatetable = new $classname(); will get an error.
Any suggestion will be highly appreciated.