0

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

2
Contributors
3
Replies
4
Views
6 Years
Discussion Span
Last Post by pritaeas
0

You have a phrase in the table, yet you want to list per word, is that correct ?

Yes, that is correct. I want to display the top 10 most searched words in order

0

In a mysql query you can group by phrase and count them, but then you would have to split them further in PHP.

select phrase,count(*) as phrasecount from search group by phrase

In PHP you would then loop through the results and generate a new array. But that depends on how you want to count the words in the phrase.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.