2020年12月23日星期三

How can I return the last inserted id in CodeIgniter 3?

Using CodeIgniter 3, I want to get the last auto-incremented id for the insert operation as the return value of my query but it is returning the wrong id which does not exist in the table.

function insert($data)  {      $ip = $this->input->ip_address();      $this->db->set('application_date',date('Y-m-d H:i:s'));      $this->db->set('created_at', date('Y-m-d H:i:s'));      $this->db->set('created_ip',$ip);      $this->db->set('update_count', 1, FALSE);      $this->db->insert(TABLE_CUSTOMER, $this->security->xss_clean($data));      return $this->db->insert_id();  }  
https://stackoverflow.com/questions/65420243/how-can-i-return-the-last-inserted-id-in-codeigniter-3 December 23, 2020 at 03:03PM

没有评论:

发表评论