Re: pagination problem

From: Date: Sun, 13 Jul 2003 05:27:34 +0000
Subject: Re: pagination problem
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-29213@lists.php.net to get a copy of this message
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>&nbsp;"; 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 (#29213) next »