You should call insert() first and then call insert_id() to retrieved the id of newly inserted row.
like this:
$this->db->insert('table_name', $data);
$db_id = $this->db->insert_id();
$this->db->insert('table_name', $data);
$db_id = $this->db->insert_id();
No comments:
Post a Comment