Jump to content

Recommended Posts

Yes it is a bit vague, however if you are recording searchterms then you should record a count against the term i.e.

searchterms

=========

id (INT)

term (VC 255)

searchcount (INT)

 

Everytime a search is performed check if the term exists in the table, if so update the count, else insert a new term. Then you can easily run a query to get your top searches i.e.

 

SELECT term FROM searchterms ORDER BY searchcount DESC LIMIT 10

Link to comment
https://forums.phpfreaks.com/topic/174469-php-popular-search/#findComment-919546
Share on other sites

Hi Neil,

 

Thanks for the reply. 

 

So I will need to record every search term?  Is this the only way to go about doing this?

 

Thanks again :)

 

Yes it is a bit vague, however if you are recording searchterms then you should record a count against the term i.e.

searchterms

=========

id (INT)

term (VC 255)

searchcount (INT)

 

Everytime a search is performed check if the term exists in the table, if so update the count, else insert a new term. Then you can easily run a query to get your top searches i.e.

 

SELECT term FROM searchterms ORDER BY searchcount DESC LIMIT 10

Link to comment
https://forums.phpfreaks.com/topic/174469-php-popular-search/#findComment-919561
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.