Jump to content

Recommended Posts

In my database i have got a field called (ID) of type integer and i have assigned it an (auto_increment) attribute...

 

My problem is that when i delete all the records from the table and add a new record thenafter, the (ID) of that new record continues to increment from the last deleted record,

so how can i set the (ID) of the new record to 1 in case all the previous records were deleted?

Link to comment
https://forums.phpfreaks.com/topic/64399-setting-a-new-value-to-a-record/
Share on other sites

This question is asked at least in two other threads and the counter question would always be 'why would u want to do that?'. The auto_increment feature is great for keeping the records unique and if u want them to behave as u want, hack mysql (lol) or dont use auto_increment but handle ids with code. In each way id say to stick to that feature and be glad with it.

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.