PhpDig.net

PhpDig.net (http://www.phpdig.net/forum/index.php)
-   Troubleshooting (http://www.phpdig.net/forum/forumdisplay.php?f=22)
-   -   How to reset paging after new search (http://www.phpdig.net/forum/showthread.php?t=1644)

salzbermat 12-16-2004 08:28 AM

How to reset paging after new search
 
When I go to the search page, enter a search term with many results, go to the second page, then enter a new search term with only very few results (that would show on one page only) I get an empty page showing results "21 - 1" and a back button. I.e. the limit is not reset after the new search. Strangely enough, the search form does not contain limit information and there is no get variable attached to the URL. I have a customized search page that stores GET variables as session vars. Is that where the script "remembers" the paging info?

Thanks for any insights on that.
Bernd

Charter 12-16-2004 10:04 AM

Are you able to reproduce this on the online demo? I tried the online demo like this: a) search for phpdig b) click next c) search for hamlet but I didn't see anything peculiar.

salzbermat 12-16-2004 10:22 AM

Salut Charter,

thanks for the speedy response (again!).

As I thought the problem was that we use a script that turns GET variables to session variables, so $lim_start is already set to the value from the last search result display.

In order to resolve this, I changed in search_functions.php the following line:
if (isset($limit_start)) { $limit_start = $limite * floor($limit_start / $limite); }

to:

if (isset($_GET['lim_start'])) { $limit_start = $limite * floor($_GET['lim_start'] / $limite); } else { $limite=0; $lim_start=0; $limit_start=0; }

Now I'm not sure whether this makes sense in all scenarios, but it works here.


All times are GMT -8. The time now is 12:23 AM.

Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright © 2001 - 2005, ThinkDing LLC. All Rights Reserved.