Hi,
What is the best way to do auto incrementing for tables in the database. The default way in the mysql database allows you to increment, but when you delete, it leaves a gap and continues with the next following number.
Q1 – Can mysql trigger herlp
Q2 - It can be done from the client side, but how do I go about it..
Auto increment (MYSQL) or (PHP)
Moderator: General Moderators
Re: Auto increment (MYSQL) or (PHP)
That is the best way.kalp1200 wrote:What is the best way to do auto incrementing for tables in the database. The default way in the mysql database allows you to increment, but when you delete, it leaves a gap and continues with the next following number.
I'd quote them if I remembered where the post was, but auto_increment fields are supposed to be unique and never, ever repeated. If something gets deleted it doesn't matter: the id number was used in the past and cannot be used again.
If you need to reuse those numbers then you're doing something the wrong way.