Are there any options to get the last insert id of a new record in CodeIgniter?
$last_id = $this->db->insert('tablename', array('firstcolumn' => 'value', 'secondcolumn' => 'value') );
Considering the table consits of fields id (autoincrement) firstcolumn and secondcolumn.
This way you can use the insert id in the following code.
Shame on me...
I looked at the user guide and the first function is
This also works with activerecord inserts...
EDIT: I updated the link
Last insert id means you can get inserted auto increment id by using this method in active record,
$this->db->insert_id() // it can be return insert id it is // similar to the mysql_insert_id in core PHP
You can refer this link you can find some more stuff.