List:General Discussion« Previous MessageNext Message »
From:Thimble Smith Date:August 16 1999 6:51pm
Subject:Re: linking search results
View as plain text  
At 11:26, 19990816, Connie E. Kwon wrote:
>Hi, I'm not sure if this is the address where I'm suppposed to mail this
>type of question, and I apologize in advance if it isn't.  I'm
>performing a search query on MySQL with PHP3 and I sometimes get 4000
>reports in my search result.  I want to limit the initial output to say
>100 reports, for which I use LIMIT.  Going beyond that, however,  is
>there a way for me to create a link that then allows a user to link to
>the next 100 results, and the next 100 , and so on?  I would really
>appreciate any hints!  Thanks!

One way to do it is to select 101 results.  If you get all 101, then
you know there are more results to print and you can make a "next"
link.  If you get 100 or less, then you know you've reached the end
of the results set, so you don't print a "next" link.  Of course, if
you get 101 results, you still only print 100 (so that there's something
to print on the next page!).

Your link to the next will have to have in it the number to start at,
like:

    <a href="your_script?from=300">next</a>

Then your program will do this:

    SELECT
    ...
    LIMIT $from, 100

Tim
Thread
linking search resultsConnie E. Kwon16 Aug
  • RE: linking search resultsTupshin Harper16 Aug
  • Re: linking search resultsThimble Smith16 Aug
    • RE: indexEe Loon17 Aug
      • RE: indexsinisa18 Aug