86Stang Posted January 14, 2008 Share Posted January 14, 2008 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? Quote Link to comment https://forums.phpfreaks.com/topic/85996-solved-counting-results-from-a-paginated-search/ Share on other sites More sharing options...
p2grace Posted January 14, 2008 Share Posted January 14, 2008 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. Quote Link to comment https://forums.phpfreaks.com/topic/85996-solved-counting-results-from-a-paginated-search/#findComment-439217 Share on other sites More sharing options...
86Stang Posted January 14, 2008 Author Share Posted January 14, 2008 Yeah, I know -- it's an odd way of doing things but basically there is no detail page. Just a listing of results. Don't ask me *points to client*. The foreach loop with the array is a great idea! Much thanks! Quote Link to comment https://forums.phpfreaks.com/topic/85996-solved-counting-results-from-a-paginated-search/#findComment-439223 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.