Jump to content

[SOLVED] Counting results from a paginated search.


86Stang

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.

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.