Re: pagination problem

From: Date: Mon, 14 Jul 2003 04:17:12 +0000
Subject: Re: pagination problem
Groups: php.db 
Request: Send a blank email to php-db+get-29220@lists.php.net to get a copy of this message
Jason, thank you so much...it works!! ... I love this community. Andrés "Jason Wong" <php-db@gremlins.biz> wrote in message news:<200307131327.35023.php-db@gremlins.biz>... > On Sunday 13 July 2003 06:17, Andres wrote: > > > I have a MySQL database full with authors and titles. I made a script that > > searchs a specific author and return the all his books titles, but I need > > it show the results from 10 to 10. I tried with LIMIT and it return just > > fine the first 10 but when I click the next 10 button it show me other 10 > > registers but from all the database not from the author selection I > > choosed. So I think it only reads the variable I send from the form once, > > the second time it seems not to read the author I want to find. > > That's right, $buscar needs to be passed onto the subsequent requests through > your 'previous' and 'next' links: > > [snip] > > > //previous link > > $total_pages = ceil($total_results / $max_results); > > if ($page > 1){ > > $prev = ($page - 1); > > echo "<a > > > > href=\"".$_SERVER['PHP_SELF']."?page=$prev\"><<Previous</a>&nbsp;"; > > } > > href=\"".$_SERVER['PHP_SELF']."?page=$prev&buscar=$buscar\"><<Previous</a>&n bsp;"; > > NB you may want to urlencode() $buscar as well. > > -- > Jason Wong -> Gremlins Associates -> www.gremlins.biz > Open Source Software Systems Integrators > * Web Design & Hosting * Internet & Intranet Applications Development * > ------------------------------------------ > Search the list archives before you post > http://marc.theaimsgroup.com/?l=php-db > ------------------------------------------ > /* > System checkpoint complete. > */ >

« previous php.db (#29220) next »