Click to See Complete Forum and Search --> : [RESOLVED] Finding 10 most popular entries in a table?
wwwfilmfilercom
May 24th, 2007, 12:59 PM
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;)
penagate
May 24th, 2007, 01:03 PM
What is your table structure like?
wwwfilmfilercom
May 24th, 2007, 01:04 PM
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..
penagate
May 24th, 2007, 01:13 PM
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.
wwwfilmfilercom
May 24th, 2007, 01:50 PM
Ah, much better idea. Thanks ;)
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.