Hi!
I'm needing a little help with the syntax...
Each time a table is edited by form, I need to update some values in another table.
I've managed to cook (based in the wiki) a way to update those values but has to execute an update command for each command, and I feel there must be a way to update all of them in one go.
So...
I'm trying to update the 4 fields of the table j_rotas with (begin_date, end_date, equip_type_id, equip_id.
I've got (working):
$query->clear();
$query->update('j_rotas')->set('equip_type_id=' . (int) $typeid )->where('id ='. (int) $id);
$myDb->setQuery($query);
$myDb->execute();
$query->clear();
$query->update('j_rotas')->set('equip_id= 99999' )->where('id='. (int) $id);
$myDb->setQuery($query);
$myDb->execute();
$query->clear();
$query->update('j_rotas')->set('begin_date= ' . $begindate)->where('id='. (int) $id);
$myDb->setQuery($query);
$myDb->execute();
$query->clear();
$query->update('j_rotas')->set('end_date= ' . $enddate)->where('id='. (int) $id);
$myDb->setQuery($query);
$myDb->execute();
how can I get them all in 1 instruction?
thanks!
I'm needing a little help with the syntax...
Each time a table is edited by form, I need to update some values in another table.
I've managed to cook (based in the wiki) a way to update those values but has to execute an update command for each command, and I feel there must be a way to update all of them in one go.
So...
I'm trying to update the 4 fields of the table j_rotas with (begin_date, end_date, equip_type_id, equip_id.
I've got (working):
$query->clear();
$query->update('j_rotas')->set('equip_type_id=' . (int) $typeid )->where('id ='. (int) $id);
$myDb->setQuery($query);
$myDb->execute();
$query->clear();
$query->update('j_rotas')->set('equip_id= 99999' )->where('id='. (int) $id);
$myDb->setQuery($query);
$myDb->execute();
$query->clear();
$query->update('j_rotas')->set('begin_date= ' . $begindate)->where('id='. (int) $id);
$myDb->setQuery($query);
$myDb->execute();
$query->clear();
$query->update('j_rotas')->set('end_date= ' . $enddate)->where('id='. (int) $id);
$myDb->setQuery($query);
$myDb->execute();
how can I get them all in 1 instruction?
thanks!