Using db insert in CI3 auto increment off in table? |
05-17-2023, 08:13 AM
(This post was last modified: 05-17-2023, 08:14 AM by xanabobana. Edit Reason: updated error text as code for easier readability )
Hi- I have a strange behavior happening and I'm wondering if anyone can help! I have a table with Users, that has an auto_increment field for the ID. Yesterday, the account approval process started failing and I see in the CI logs:
Code: ERROR - 2023-05-17 10:24:52 --> Query error: Duplicate entry '10084' for key 'PRIMARY' - Invalid query: INSERT INTO `tblUser` (`active`, `first_name`, `last_name`, `company`, `phone`, `email`, `username`, `password`, `ip_address`, `created_on`) VALUES (0, 'Xana', 'Wolf', 'uvm', '000-000-0000', '[email protected]', 'Xana Wolf', '$argon2i$v=19$m=4096,t=3,p=1$beO82X4wsRUxieorH5iRjg$C9HPtN9TYYmLLw+/VPJGzgh6ieZidOHwXwbcYtkj/OE', '132.198.100.190', 1684333492) The code generating the error above is this: Code: $data = [ The insert statement looks correct to me, so I'm confused why the auto_increment value keeps getting out of whack? I can add something in the code to check the max ID and make sure the auto_increment value is set correctly, I just would like to figure out why this is happening! I did find a thread about the mysql NO_AUTO_VALUE_ON_ZERO setting, but I checked and it wasn't set. |
Messages In This Thread |
Using db insert in CI3 auto increment off in table? - by xanabobana - 05-17-2023, 08:13 AM
RE: Using db insert in CI3 auto increment off in table? - by JustJohnQ - 05-18-2023, 11:29 PM
RE: Using db insert in CI3 auto increment off in table? - by xanabobana - 05-19-2023, 06:27 AM
RE: Using db insert in CI3 auto increment off in table? - by JustJohnQ - 05-19-2023, 06:47 AM
|