mister2quick Posted April 24, 2009 Share Posted April 24, 2009 I have a database set to auto increment whenever a new row is added. Is it possible to to have the auto-increment field to auto-update when a row is deleted? IE: when row 17 is deleted, row 18 becomes row 17, row 19 becomes row 18? And when a new row is added it becomes row 19? I'm fairly new to the scene, so any and all help is greatly appreciated! If it means anything at all, i'm using XAMPP 1.7.0 with phpmyadmin. Thanks! Quote Link to comment https://forums.phpfreaks.com/topic/155529-solved-auto-increment-1st-available-number/ Share on other sites More sharing options...
PFMaBiSmAd Posted April 24, 2009 Share Posted April 24, 2009 The intent of an auto incrementing index is that it is a unique identifier. Consider the case were two different people are making changes at the same time. One person deletes a row and adds a new one before the second person clicks on their form to delete a row. If the auto incrementing index gets reused, the second person just deleted the row that the first person added, not the row that they wanted to delete because it had already been deleted by the first person. If you or your application expects no gaps in the auto incrementing index, you are attempting to use it for something that it is not intended to be used for. Quote Link to comment https://forums.phpfreaks.com/topic/155529-solved-auto-increment-1st-available-number/#findComment-818443 Share on other sites More sharing options...
mister2quick Posted April 24, 2009 Author Share Posted April 24, 2009 After reading what i wanted to do i realized that it was a foolish thing to ask. You are absolutely correct. My mistake! Quote Link to comment https://forums.phpfreaks.com/topic/155529-solved-auto-increment-1st-available-number/#findComment-818482 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.