SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    is craving 'the potato' slayerment's Avatar
    Join Date
    Nov 2002
    Location
    Scottsdale, Arizona, USA
    Posts
    603
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question: Making new ID entries = 1

    If I use ID as a primary key, is it possible to make any new entry on the database be ID 1 automatically and make all the rest shift down one. I would rather this as opposed to say 15 or whatever comes next? Or if this isn't possible, could PHP somehow take the total ID's and subract the current ID number to make the latest entry show up as the first? Hope this isn't too confusing. This would really help. Thanks

  2. #2
    SQL Consultant gold trophysilver trophybronze trophy
    r937's Avatar
    Join Date
    Jul 2002
    Location
    Toronto, Canada
    Posts
    39,347
    Mentioned
    63 Post(s)
    Tagged
    3 Thread(s)
    there should be no reason for you to want to manipulate the number

    it could start at 78345632 and increment by 2397653 and this should make no difference to you

    if it does make a difference, then perhaps you should not be using an auto_increment, and just assign the numbers yourself

    however, even if you assign numbers yourself (which you really should not do), there's no way you can get the new ones to come in at 1 and bump all the existing ones up -- that would destroy any linked table relationships

    rudy
    http://r937.com/

  3. #3
    is craving 'the potato' slayerment's Avatar
    Join Date
    Nov 2002
    Location
    Scottsdale, Arizona, USA
    Posts
    603
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks for clearing this up.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •