Re: how to find most popular keyword searched

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Further to my previous answer, I don't think that this is possible using 
SQL alone.

I think your only options are to manually count using php and an array, 
or to consider normalising your database further.

A search engine I built recently stores searched terms as well as the 
entire phrase using a foreign key.

eg I would have 2 tables "phrase" to many "term"

phrase
=======
phrase_id
phrase

term
=======
term_id
term
phrase_id

where phrase_id is the foreign key in term.

Each term is then stored individually allowing you to count them.

Hope that helps.

Giles

Imran wrote:
> 
> 
> Friends,
> 
> I'm looking for a script or (ideally) a mysql query that could show the most
> popular keyword searched. The table below stores all the keywords searched
> from the website. Now the admin wants to see which keyword is "The Most
> Popular" being searched by users. Mr.Bean or Bean or Bean Joker should show
> 3 occurences with "The Most Popular" keyword.
> 
> Plz Note: Admin will not query (or search) it using forms etc. He simply
> wants to see the table with top occurence.
> 
> *tbl_keywordsearch*
> 
> **
> *search_id | keyword_searched*
> + = = = = = = = = = = =
> 1 | Mr. Bean
> 2 | Bean
> 3 | Bush
> 4 | George Bush
> 5 | Bean Joker
> + = = = = = = = = = = =
> 
> Thanks,
> Quest
> 
> [Non-text portions of this message have been removed]
> 
> 

[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Soap]     [Kernel Newbies]     [Yosemite]     [Yosemite Campsites]

  Powered by Linux