Jump to content

PHP popular search


_tina_

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.