Inserted id in codeigniter

$this->db->insert_id();

After an insert query this will return the inserted primary key id.