Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer

Re: DB Search

by atemon (Chaplain)
on Aug 08, 2007 at 10:45 UTC ( #631276=note: print w/replies, xml ) Need Help??

in reply to DB Search


To get pagination, you need to do following.

  1. Format your SQL as something like $SQL = "SELECT * FROM xyz ..... LIMIT $start, $count". Where $start is the count to start with and $count is No of records to be displayed. 0,10 will display 1st 10 records, 10,10 gives items 10 to 19 etc...
  2. On "Next >>" in HTML page, you may submit value for $start as $start+$count.
  3. On "<< Prev in HTML page, you may submit value for $start as $start-$count.
  4. Make sure that $start-$count won't go negative
  5. Make sure that $start+$count wont go above COUNT(*) of that SQL without limit.

Cheers !


Updates :

  1. Refer MySQL Documentation for syntax of  LIMIT in SELECT statement.
  2. Have a look at PerlMonks FAQ, The Perl Monks Guide to the Monastery for more information on how the Monastery works. How (Not) To Ask A Question will be a good guide. There are hundreds of thousands of posts here, Super Search is your friend. There are more than one postings available in the monastery regarding pagination

There are three sides to any argument.....
your side, my side and the right side.

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://631276]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (5)
As of 2022-05-25 12:57 GMT
Find Nodes?
    Voting Booth?
    Do you prefer to work remotely?

    Results (90 votes). Check out past polls.