Jump to content

Recommended Posts

Every time somebody searches, you add that to a database table, perhaps with other info like the IP address. If you want to know what the most popular database searches are, you query the database to return the column, use some function like trim() on each row, also converting all chars to lowercase, and then you'll use a simple function to count all occurrences of each search term or phrase. Put each term or phrase in an array with it's count, and then sort the array by count. Pick off the top 5, 10, or whatever. This might be a lot of work.... so you might cache this and only run it once every half hour or something. Also, since you have a top 5 or 10, you might consider deleting rows that don't seem to have a chance to compete, if you know what I mean. You could probably tweak this to perfection, or with minimal work at least get something usable.

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.