phpMyAdmin re: Next Autoindex

Discussion in 'PHP' started by Lucy, May 7, 2007.

  1. #1
    Hi,

    I have entered data into tables in phpMyAdmin. Then, I removed a couple of rows.

    Later, when I re-entered more data into the table it stuffed up the auto-incrementing. I think it may have something to do with the 'Next Autoindex' it didn't refresh when I deleted the rows.

    Does anyone know how to rectify this in phpMyAdmin?
     
    Lucy, May 7, 2007 IP
  2. void

    void Peon

    Messages:
    119
    Likes Received:
    9
    Best Answers:
    0
    Trophy Points:
    0
    #2
    The next index won't change when you delete rows, only when you add a new one. Keys aren't reused when you delete rows, is that what you were expecting?
     
    void, May 7, 2007 IP
  3. Lucy

    Lucy Peon

    Messages:
    13
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Initially I added rows and it incremented fine.... But then I deleted rows later on.... Then, when I tried to insert them another time all the incrementing was muddled up because it's counting from the last ones that were entered.
     
    Lucy, May 7, 2007 IP
  4. gibex

    gibex Active Member

    Messages:
    1,060
    Likes Received:
    21
    Best Answers:
    0
    Trophy Points:
    95
    #4
    to reset auto_increment to a given value use ALTER like this:

    ALTER TABLE table_name auto_increment=value;
     
    gibex, May 10, 2007 IP
  5. ketan9

    ketan9 Active Member

    Messages:
    548
    Likes Received:
    9
    Best Answers:
    0
    Trophy Points:
    58
    #5
    Go to "Operations" tab and you can set the autoincrement value to some number you wish!
     
    ketan9, May 11, 2007 IP