I assume you're doing this as a CGI to return records
from a dastabase.

I've just done this myself - basically redoing the
select statement for each new page, with a LIMIT
statement in MySQL saying eg: LIMIT 21,10 (meaning
start at 21 and select the next 10)

Of course, doing it this way you have to pass certain
paramaters to the CGI script every time. I have links
on my output pages saying "goto page 2, goto page 3
etc..." 
If you click on the "goto page 2" link, the <a
href=..> tag will goto the url of a perl script that
does the search, but the url will have to contain
information telling the script where to start
searching, and also what the original search terms
were (so it can perform the search again). So your <a
href> tag will be something like:

<a
href="cgi-bin/page.cgi?start=21&searchterm1=Monty&searchterm2=Python">

hope this makes sense!

There is a very good discussion of this in Paul
DuBois' fine book, "MySQL and Perl for the web". Also
a few months ago on this list - see these links:

http:[EMAIL PROTECTED]/thrd2.html
 

(near the bottom of the page. Subject: 1-10, 11-20)

and the actual thread:

http:[EMAIL PROTECTED]/msg07824.html

and the responses to it.

HTH,
Cheers,
Henry

 --- Jason Wilkes <[EMAIL PROTECTED]> wrote: >
Hi folks,
> 
> I'm not a DBI newbie, but am struggling with some
> code.
> I can happily make a select field1, field2 and
> return
> all rows to a web page.
> However I want to return only a partial number of
> rows
> ( say 5 ) on successive pages - much like a search
> engine (where page 1 give results 1-10, and a link
> to
> page 2 gives rows 11-20 etc etc).
> 
> I think I need to use fetchrow_arrayref with
> something
> like
> for ($count = 0; $count < 10; $count++){
> $data = $sth->fetch[$count];
> ....do something with $data
> }
> however I can't get the desired effect ((my personal
> opinion in an otherwise execeleent book ;-) is the
> o'rielly book is a bit vague also))
> 
> Does anyone have any pointers or even a code snippet
> ?
> 
> it would be much appreaciated
> 
> Tory.
> 
> __________________________________________________
> Do You Yahoo!?
> Everything you'll ever need on one web page
> from News and Sport to Email and Music Charts
> http://uk.my.yahoo.com 

__________________________________________________
Do You Yahoo!?
Everything you'll ever need on one web page
from News and Sport to Email and Music Charts
http://uk.my.yahoo.com

Reply via email to