• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
ARC Delete/Insert creates additional ID

I'm not sure exactly why this is happening, and I don't know if this is a bug or not. I have a simple table. Here is the create statement for it.

CREATE TABLE `brokerage_zip_range` (
     `id` int(11) NOT NULL auto_increment,
     `zip_code` varchar(10) NOT NULL,
     `brokerage_id` int(11) NOT NULL,
     PRIMARY KEY  (`id`)

I have code that looks like this in a model:

public function assign_zip_range($brokerage_id, $zip_code_list) {
     $this->db->set('brokerage_id', $brokerage_id);
     $this->db->set('zip_code', $zip_code_list);

(Please note that for reasons I won't get into here, I can't just make this an update statement).

The problem I am having is that while this code executes fine, the inserted record is incremented by more than one. So, prior to the execution of this code, the record might look like:

id    zip_code brokerage_id
7     95202     2

After I run the code (say, with zip code 92222), it now looks like:

id    zip_code brokerage_id
9     92222     2

The next auto increment value should be 8, not 9.

Am I doing something wrong or is this a CI thing? Also, I will point out that I have tried running this code by itself in CI, meaning there are no other operations happening at all before or after it.

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

Users browsing this thread:
1 Guest(s)

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2019 MyBB Group.