Hai, I have a problem in my program. Aim of the script is that will execute the select query on the given table with required conditions, get list of results and show it in a kind of partly lists (like showing results 1-10, 1-20 etc)

I want to show out in the view like 'showing 1-10 of 300 results' and upon clicking it should display 'showing 11-20 of 300 results' etc.

The problem is the select query will take long time to get result, so the option is to use 'LIMIT' operator in query which will work fine except that my program will miss out total number of results returned from the query.

I found there could be two alternatives for this. First is firing up two queries. one to get list of 1-10 and second query to get count of the query execution (like select count(*) from table)

Second alternative would be to always get select * from table and show up first 10 records or like wise. This suffers from my previous mentioned problem of query taking long time.

I am sure there would be another excellent method for this. (lot of sites are using this including perlmonks!). So how about doing this out, suggestions please.

Note: The query could be anything and dynamic joins could be resulted, so maintaing separate count for the table is also rulled out

Thanx for any suggestions
gopi

In reply to Perl - Database - List View issue by Anonymous Monk

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



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.