Please any body can help.
The right procedure for methods(functions) using in codeigniter.
I mean that to write separate method for every task in model or to use one method that is used for general purpose. i.e
1:-One approach
public function insert_records($tabel, $data){
return $this->db->insert($tabel, $data);
}
2:-Second approach
public function insert_user(){
return $this->db->insert('users', array('name'=>$this->input->post('name'),'email'=>$this->input->post('email'));
}
Same for teacher
public function insert_teacher(){
return $this->db->insert('teachers', array('name'=>$this->input->post('name'),'email'=>$this->input->post('email'));
}
Please give the right solution that to use separate functions is best or to pass data and table name in one functions is best.? if any one have no proper solution please leave for expert one's so that to give the right solution.