determining which words are searched the most

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Smudly
Forum Commoner
Posts: 71
Joined: Wed Jun 09, 2010 10:09 pm

determining which words are searched the most

Post by Smudly »

Hey, I have a search feature that searches for words in my database.
I am currently storing all searches that users make in a table called `search`. I need to list the top 10 words that are searched for the most, excluding common words like "the, and, or, etc".
Because the searches users make are stored into a table, it should be fairly easy.
Could anyone give an example of how to do this?

Here's how my sql table looks:

table name: search

columns:
id (autoincrement)
phrase
date
resultsfound
ip
User avatar
DigitalMind
Forum Contributor
Posts: 152
Joined: Mon Sep 27, 2010 2:27 am
Location: Ukraine, Kharkov

Re: determining which words are searched the most

Post by DigitalMind »

Code: Select all

select phrase, count(*) as phrase_count from search where phrase not in ('the', 'and', 'or', 'etc') group by phrase order by phrase desc limit 10
Post Reply