Re: Pragmatically changing a "Record Number"

From: Date: Wed, 29 Aug 2007 18:27:57 +0000
Subject: Re: Pragmatically changing a "Record Number"
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-261475@lists.php.net to get a copy of this message
Jason Pruim wrote:
3. Ask yourself, "Is it important to keep the auto-increment field contiguous?"
The main reason for changing it is I do currently have an option to sort by record number, although, if I add a Record number in php, but still have it sort based off of the record number stored in the database, it would still sort right, but also look right...
Are you thinking mysql reuses auto-increment number? If so, your mistaken. MySQL will not reuse an auto-increment unique value. say you have an empty table with an auto-increment column. You add 5 row your next id to be used is 6. if you delete id # 2 and 3 the next id to be used will still be 6 not 2 it does not go back and fill in the holes/gaps -- Jim Lucas "Some men are born to greatness, some achieve greatness, and some have greatness thrust upon them." Twelfth Night, Act II, Scene V by William Shakespeare

« previous php.general (#261475) next »