this is my function in model.php
function add_user($data, $table){ $this->db->trans_start(); $insert_id = $this->db->insert($table, $data); $this->db->insert_id(); $this->db->trans_complete(); return $insert_id; }
how to get the value of $insert_id in other function *Sorry for my bad english
Advertisement
Answer
you can do like this in controller
$inserted_id = $this->Add_user_model->add_user($data, $table);
documentation : https://codeigniter.com/userguide3/general/models.html#id4