Re: [PHP] Pragmatically changing a "Record Number"




On Aug 29, 2007, at 2:27 PM, Jim Lucas wrote:

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.

No, I am aware that it doesn't reuse the auto increment numbers.

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

And what I'm looking for is away to take rows 4 and 5 and move them to rows 2 and 3 so the next record inserted would be row 4 :)


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



--

Jason Pruim
Raoset Inc.
Technology Manager
MQC Specialist
3251 132nd ave
Holland, MI, 49424
www.raoset.com
japruim@xxxxxxxxxx
.



Relevant Pages

  • Re: [PHP] Pragmatically changing a "Record Number"
    ... 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... ... MySQL will not reuse an auto-increment unique value. ... "Some men are born to greatness, some achieve greatness, ...
    (php.general)
  • Re: Michel Houellebecq amplifies Aristotle
    ... Possibly one reason I never heard ... I do not refer to the close relatives of any boor that I ... I do not share their sort of mentality, ... false education imposed by mendacious European scholarship. ...
    (rec.arts.books)
  • Re: Deconversion
    ... The obvious sort of thing (albeit rather unimaginative, ... specific claim about the nature) of God should look like. ... morality etc require some variety of theism for their justification. ... argument for limiting the capacity of human reason, ...
    (uk.religion.christian)
  • Re: Chrissy was [snip]
    ... that sort of thing. ... So, based on that, I'd say that there's good reason to think that I'm ... it had something to do with gravitation, and from them to figure out ... who just yell at me and insult me when I say things that upset them. ...
    (uk.people.support.depression)
  • Re: Why should atheism be the default position?
    ... Now where are your arguments that the existence of any sort of "God" is ... I don't believe there are any arguments from atheists. ... The only "argument" needed is that when there is no reason to believe ...
    (uk.philosophy.atheism)