SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Addict
    Join Date
    Dec 2005
    Posts
    381
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question Changing the order of a top 40 list table.

    Hi what I'm looking to do is to allow a user to change the order of a list of 40 items. Its going to be a sort of top 40 list.

    There will only ever be 40 items in the table but the order of them will change from week to week, some may be deleted and others added in there place but there will always be 40 items.

    I need them to show in a set order on the page so I was using the Id column in the table to do this ie Id 1 shows first Id 40 shows last in the list.

    But how would I build the part that allows someone to change the order of this table? If this is a really easy thing then sorry for being a bit thick but its been one of those days!

    Any help would be really appreciated with this. If I've not explained it very well let me know and I'll try to do it more clearly.

    Thanks in advance

  2. #2
    SitePoint Guru mmarif4u's Avatar
    Join Date
    Dec 2006
    Location
    /dev/swat
    Posts
    619
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Can you explain, what type of sorting you need.
    Is it some thing like desc or asc?

  3. #3
    SitePoint Addict
    Join Date
    Dec 2005
    Posts
    381
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    What I need to be able to do is say "red shoes" was ranked 3rd last week but is now gone up to 1st place I need to be able to change its order so that it now shows in 1st place this week and something else would then show in 3rd place. Does that make sense?

  4. #4
    SitePoint Wizard
    Join Date
    Mar 2002
    Location
    Bristol, UK
    Posts
    2,240
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Create a table called rankings which holds an item ID, a date, and a position.

    To call a particular week's rankings you'd use a query like SELECT item, position FROM rankings WHERE date = '2009-10-14' ORDER BY position DESC;


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
  •