php - What's the way to go when inserting values to multiple tables? -
i'm inserting values onto employees
table using in controller:
$this->employee->create(); if ($this->coreprogram->save($this->request->data)) { $this->session->setflash('program has been added.'); $this->redirect(array('action' => 'index')); } else { $this->session->setflash('unable add record.'); }
however, want insert record table audit
. more specifically, current date along employee_id
field used employees
. best approach this? should create $this->audit->create();
? or there better way?
use insert trigger on employees table inserts audit entry audit table:
create trigger tr_employees_ins on dbo.employees insert begin insert dbo.audit( [op] ... employee_id ...) select 'ins' ... employee_id inserted end
Comments
Post a Comment