Re: pagination problem

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.
*/


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux