|
-
May 24th, 2007, 12:59 PM
#1
Thread Starter
Hyperactive Member
[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
-
May 24th, 2007, 01:03 PM
#2
Re: Finding 10 most popular entries in a table?
What is your table structure like?
-
May 24th, 2007, 01:04 PM
#3
Thread Starter
Hyperactive Member
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..
-
May 24th, 2007, 01:13 PM
#4
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.
-
May 24th, 2007, 01:50 PM
#5
Thread Starter
Hyperactive Member
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|