How to get last insert id in Codeigniter

How to get last insert id in Codeigniter

$this->db->insert(‘users’, $data); # where $data is an array

$insert_id = $this->db->insert_id(); # insert_id() fucntion returns last insert id

return $insert_id;

 

 

Share this post

Leave a Reply

Your email address will not be published. Required fields are marked *