Results 1 to 5 of 5

Thread: Hey everyone, I gotta Question :)

  1. #1
    Join Date
    Mar 2008
    Posts
    122
    Thanks
    17
    Thanked 5 Times in 5 Posts

    Default Hey everyone, I gotta Question :)

    First of all, I haven't posted on here in a long while, some of the older Member's may know who I am.

    Glad to see my Word Association Game is still going.

    Ok, my question is:

    I am currently writing a PHP + MySql guestbook, and i'm having a little trouble with deleting the posts, see, whenever I delete a post, it doesen't update the ID's so, say, i have 3 posts and i delete the 2nd post, it leaves post 1 & 3 and therefore looks wierd :S. I need to know how to update all the ID's so that it displays 1 & 2 for example.


  2. #2
    Join Date
    Mar 2008
    Posts
    122
    Thanks
    17
    Thanked 5 Times in 5 Posts

    Default

    Bumpity

  3. #3
    Join Date
    Jan 2007
    Location
    Davenport, Iowa
    Posts
    2,347
    Thanks
    99
    Thanked 112 Times in 110 Posts

    Default

    Wouldn't it be better to leave the gaps and then whenever the next person signs the guest book you can put their name in the gap?

    For example:

    ID name
    1 Fred
    2 Rick
    3 Sara
    delete Rick. Table is now:

    ID name
    1 Fred

    3 Sara
    New person signs guest book. Table becomes:

    ID name
    1 Fred
    2 John
    3 Sara
    I suppose if you still wanted to do it your way you could retrieve the contents of your table, put it into an array, resort the array to remove all of the gaps, drop all of the rows from the table, then populate your table with your sorted data.
    To choose the lesser of two evils is still to choose evil. My personal site

  4. #4
    Join Date
    Mar 2008
    Posts
    122
    Thanks
    17
    Thanked 5 Times in 5 Posts

    Default

    @james438

    Thank's for the input, I'll try this, if it work's ill thank you.

    Anyone else ?

  5. #5
    Join Date
    Jan 2007
    Location
    Davenport, Iowa
    Posts
    2,347
    Thanks
    99
    Thanked 112 Times in 110 Posts

    Default

    If you get stuck, let us know and we can probably help you to create the script you need.
    To choose the lesser of two evils is still to choose evil. My personal site

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
  •