Results 1 to 5 of 5

Thread: [RESOLVED] Finding 10 most popular entries in a table?

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Feb 2006
    Location
    From the UK
    Posts
    422

    Resolved [RESOLVED] Finding 10 most popular entries in a table?

    I'd like to add a feature to my site whereby whenever someone clicks on an item it will add that items tags to a table. Then, I can look into this table and find out the top 10 entries. Make sense?

    The bit I'm stuck on is how to find just the top 10 UNIQUE entries rather than just the top 10 entries.. How can I find it out?

    Thanks

  2. #2
    I'm about to be a PowerPoster!
    Join Date
    Jan 2005
    Location
    Everywhere
    Posts
    13,647

    Re: Finding 10 most popular entries in a table?

    What is your table structure like?

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Feb 2006
    Location
    From the UK
    Posts
    422

    Re: Finding 10 most popular entries in a table?

    table Tags
    tagID - int
    tagName - string


    That's it. So when an item is clicked, I just get it's tags and add each one seperately to the table..

  4. #4
    I'm about to be a PowerPoster!
    Join Date
    Jan 2005
    Location
    Everywhere
    Posts
    13,647

    Re: Finding 10 most popular entries in a table?

    Why not:

    tagID
    tagName
    tagCount

    Then, when you click an item, check to see if it is present in the table; if it is, increment its count field; if it's not, add it.

    Or even better, add the tags when you add the item, so you don't have to check whether it exists or not.

  5. #5

    Thread Starter
    Hyperactive Member
    Join Date
    Feb 2006
    Location
    From the UK
    Posts
    422

    Re: Finding 10 most popular entries in a table?

    Ah, much better idea. Thanks

Posting Permissions

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



Click Here to Expand Forum to Full Width