Jump to content

[SOLVED] auto_increment issue after record delete


phpdragon

Recommended Posts

MySQL ver 4.1.22, using phpmyadmin 2.10.0.2

 

I have a table with auto_increment loginID, I had 33 records which store (loginID,userID,ipAddress,loginTime,logoutTime), which were created while testing, I used phpmyadmin selected records 1-30 and use the delete tool, leaving records 31-33, table listed as follows

 

31

32

33

 

I have now added some more records 34-37 by using the pages that generate them but now the auto_increment is messed up. It still seems to assign the correct value but the order in which it is listing now is weird eg

 

loginID(auto_increment)

37

36

35

34

31

32

33

 

Can someone help me workout what is going on with this please, very much appreciated.

Link to comment
Share on other sites

this is the order phpmyAdmin displays them now, usually they are listed in order of the rows.

 

I had another issue earlier today with the users table, whch was a copied table with 6 existing users already in it, to which I deleted the last 4 making the next entry autoID still 7. This happened and this was fine but the table also started to display weird in phpmyAdmin with the rows out of order, I had not noticed auto_increment feilds behave like this before in phpmyAdmin, when I called the userID 1 in a script and then assigned it to a session it would assign the session the value of 7 for the ID, this happend for record 2 which I also left behind, and this also got assigned the value 0f 7 in the session, but all other newly created users got assigned their correct ID as session ID using exactly the same script. For some reason I had to change userID in the script to usersID and the problem stopped, very strange.

 

So you beleive I have nothing to worry about with the data integrity then and the table should continue to insert and delete as normal?

 

cheers for you help

 

Link to comment
Share on other sites

this is the order phpmyAdmin displays them now, usually they are listed in order of the rows.

 

Yes, but it could display them in any order at all. The order is not defined, and relying on a default order is likely to cause problems.

 

So you beleive I have nothing to worry about with the data integrity then and the table should continue to insert and delete as normal?

 

Nope. Shouldn't be anything to worry about.

 

All the best

 

Keith

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.