I have this really weird problem with my MySQL table. After some time a realise that there are 2 extra rows at the end of the table. Deleting the entries in phpmyadmin just creates another 2 more of these unwanted rows with increasing id
that is on auto-increment
. I tried deleting with phpmyadmin and Navicat, both still causes the 2 extra rows to be created on refresh. Any ideas?
EDIT: I did notice something weird, the last id which is a auto-incrementing primary key is 2682, but the AUTO_INCREMENT value in the options tab is 7567, is something amiss? These 2 values are the same for other tables which did not have this problem...
UPDATE: I exported the table into a .txt file, and notice there are empty entries with NULLS and default values and empty values from id=2683 to id=7567!!
I was running some erroneous Active Records code using Codeigniter framework before this happened. So the problem is really due to the AUTO_INCREMENT
number being different from the last id
in the table, and somehow having empty rows from id=2683
to id=7567
.
Solution was to export table to excel, delete the old table from db, remove all rows after id=2682
in excel and import the excel back into the table to recreate the original table.
Thanks for the suggestions guys! :)