Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

Hi,

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 !

--VC

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.


In reply to Re: DB Search by atemon
in thread DB Search by JimJx

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others cooling their heels in the Monastery: (4)
As of 2024-04-20 01:31 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found