I have a case in my project to execute 2 queries with same condition and clause in mysql. To the point, this is the sample code :
Model
public function action_1(){
$this->db->where('id', 2);
return $this->db->update('tbl_1', array('name'=>'aldi'));
}
public function action_2(){
$this->db->where('id', 2);
return $this->db->delete('tbl_2');
}
Controller
$this->model->action_1();
$this->model->action_2();
I think this is less efficient. And my question is, can I just write in model something like :
public function do_all_actions(){
$this->db->where('id', 2);
$this->db->update('tbl_1', array('name'=>'aldi'));
$this->db->delete('tbl_2');
}
And :
$this->model->do_all_actions()
In Controller?? Thanks before.