[eluser]dmol[/eluser]
Hi all,
I'm looking for a way to keep track of which tables/fields in a DB need to be updated.
Lets say I have 6 tables sharing a common key($id) and there are also some duplicated fields. When I'm doing an update, I need to keep track of which tables to update and which fields. Is there a good way of doing this? my approach is as follows:
pseudo code:
1/Get a list of tables/fieldnames used in the query as follows:
$data['table_name']['fields'][] = $this->db->list_fields('mytable');
--repeat for each table queried.--
2/Process form
3compare existing field values to new values and store changes as $changes[$field_name] => $value
4/foreach $data['table_name] => $myfield
if exists ($changes[$myfield]) --> function to update db with args($id, $table, $field, $value)
Is there a 'stream-lined' way of doing search->update multiple tables? I find the above approach too cumbersome.
Thanks
Dave