CodeIgniter has a $this->db->insert_id() method. In your case you could do the following: $this->examples_model->db()->insert_id(); Alternatively, if you use MY_Model's "save" method instead, it will automatically return the insert_id: $id = $this->examples_model->save($values);
Comments
$this->examples_model->db()->insert_id();
Alternatively, if you use MY_Model's "save" method instead, it will automatically return the insert_id:
$id = $this->examples_model->save($values);