👋 Hello! I'm Alphonsio the robot. Ask me a question, I'll try to answer.
codeigniter last inserted id

With CodeIgniter 3, the method $this->db->insert_id() returns the ID of the last row inserted in a DB table.

// Insert $data in myTable (create a new row)
$this->db->insert('myTable', $data);

// Get the ID of the new row
$id = $this->db->insert_id();


More