RE: How do you get last insert id in codeigniter?

How do you get last insert id in codeigniter?

B Mathur Team Leader Asked on February 12, 2018 in CODEIGNITER.
Add Comment
2 Answers

you can use $this->db->insert_id();


public function insert_data($data)

{

$this->db->insert("table name",$data);

$lastID = $this->db->insert_id();

return $lastID;

}

Senior Developer Answered on February 12, 2017.
Add Comment

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.