Page 1 of 1
new value in database
Posted: Wed Dec 06, 2006 6:30 pm
by hrubos
I use PhpMyAdmin to design database, And I have problem that sometimes I only try to insert some values then I delete it.But when I continue to insert new value, there is continueing id (id is autoincrement, example the last id : 25, but I deleted 25th value, I insert a new value and it is 26th value, not 25th however database are 25 values. I want that new value was inserted, is 25th value ).
How can I do to refresh database???
Posted: Wed Dec 06, 2006 6:49 pm
by Luke
why? that's what the auto_increment is for... not to make sure every id is in order ??
Posted: Wed Dec 06, 2006 6:55 pm
by hrubos
The Ninja Space Goat wrote:why? that's what the auto_increment is for... not to make sure every id is in order ??
because user complete information into database and so I have to make id autoincrement.
Posted: Wed Dec 06, 2006 7:15 pm
by Luke
users should not have access to the auto_increment value... and auto_increment value should have no really association with whatever it's used to identify. All it does is create a unique id for each record... there is absolutely NO reason why it should EVER have to be in perfect order. as long as it increments every time...
Posted: Wed Dec 06, 2006 7:29 pm
by hrubos
The Ninja Space Goat wrote:users should not have access to the auto_increment value... and auto_increment value should have no really association with whatever it's used to identify. All it does is create a unique id for each record... there is absolutely NO reason why it should EVER have to be in perfect order. as long as it increments every time...
So I have one question
What will be id when deleting in database?New id is continue or have same value (I have shown a example).
Because I don't have experience with database. This is the first time I have worked in database.
Posted: Thu Dec 07, 2006 12:08 pm
by feyd
Do like many of us did when we were starting out with databases: try it and find out for yourself.
Posted: Thu Dec 07, 2006 11:16 pm
by califdon
As others have said, the purpose of an auto-increment field is to insure that there are no duplicate identifiers in a table. Users (and even administrators) should never be concerned about WHAT value it contains, only that it is unique. If that's not what you wanted, you should not have used an auto-increment field. Databases are not just glorified spreadsheets, they are based on strict mathematical set theory. If you are going to continue working with databases, I strongly recommend that you take a course in database theory.