Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public function insert_user($name, $desc)
- {
- $this->db->trans_start(TRUE);
- $this->db->set('Name', $name);
- $this->db->set('Desc', $desc);
- $this->db->insert('user');
- $id = $this->db->insert_id();
- $this->db->trans_complete();
- return $id;
- if ($this->db->trans_status() === TRUE)
- {
- insert_access($get);
- }
- public function insert_access($get)
- {
- $data = $this->input->post('pTableData');
- $tableData = json_decode($data,TRUE);
- foreach ($tableData as $get)
- {
- $this->db->set('UserID', $id);
- $this->db->set('AccessName', $get['accessName']);
- $this->db->set('Password', $get['password']);
- $this->db->insert('access');
- $id_access = $this->db->insert_id();
- return $id_access ;
- }
- }
- $id = $this->db->insert_id();
- if ($this->db->trans_status() === TRUE)
- {
- $this->insert_access($id); //if in the same model
- $this->another_model->insert_access($id); //if some other model
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement