Jump to content

[SOLVED] Counting results from a paginated search.


Recommended Posts

I'm wondering how it's possible to count a search result but only if the user makes it to the paginated page that it's on.

 

As an example, let's say a user searches for "worms" and it returns 800 results, paginated into 25 results per page.  I would like the first 25 results to have a +1 added to their number of views.  If he moves on to page two of the results, those 25 would now get a +1 to their number of views.

 

Any thoughts?

Your logic behind this seems strange to me, why would you want to increase their number of views simply based off of a search query?  Wouldn't you want to increase the number of views only when they actually click and view that page?

 

However to answer your question, I would save the id of each row being shown to an array.  Then do a foreach loop through that array updating their "views" field.

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.