Jump to content

Archived

This topic is now archived and is closed to further replies.

jaymc

Auto Increment - Deletion

Recommended Posts

I have my ID field set up as auto increment

Now, lets say I have the following in a database in the ID field

1
2
3
4

If I delete record 4, that means I will be left with

1
2
3

However, and here is my problem. When a new record is added, it auto increments the ID field to 5. Obviously their is some kind of counter which still holds 4 as the last number.

Is their anyway around this without querying the database?

Share this post


Link to post
Share on other sites
Any way around what?  What are you using this field for that it matters?

Share this post


Link to post
Share on other sites
Song ID's.

In other words, I want it to auto increment from the last ID in the table

Share this post


Link to post
Share on other sites
Treat auto-incrementing fields as if they belong to MySQL (which they do) and you can't mess with them, instead of something that's yours.  You'll be glad you did when you want to use ids from different tables to do some cross-referencing.

Share this post


Link to post
Share on other sites

×

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.