Mailing List Archive



Back to the month index Back to the list index

Jethro Wright III (jetman@li.net)
Thu, 13 Nov 1997 23:26:51


Message-Id: <199711140422.XAA11760@linet06.li.net>
Date: Thu, 13 Nov 1997 23:26:51
From: Jethro Wright III <jetman@li.net>
Subject: Re: Showing query results 10 at a time

()Suppose a msql query is called thru' phtml and the query returns about
()30 records:
()
()1. I want to show the results in 3 stages in steps of 10 records in a
()page so that the visitor can browse the results by pressing "next 10
()hit" button.
()Is it possible to do it without re-executing the query each time?
()
()2. For e.g, visit the page http://www.pppindia.com/trade/trade.html
()where there are atleast 10-20 postings in a day with about 3000 hits per
()day. If I convert this perl cgi into phtml-mSQL, will the mSQL be able
()handle the burden? I hear people saying msql to be very vulnerable.

        I don't know what phtml is, but one could use a scripting language
(Perl, C, Python, VizBasic, etc.) to gen a multiple page query results
listing. Depending on the amount of traffic your site gets, this would
allow one to display a limited subset of a given query relatively
easily. That is, you gen all of the pages from the user's query and
simply let the user navigate fwd and back as they need to.

        For example: The CGI does a query which returns 50 records. So
why not gen 5 pages: SQLpage1, SQLpage2, SQLpage3, SQLpage4, and
SQLpage5.html. Each of these pages would only display 10 records and
a Previous/Next button at the bottom, to navigate to appropriate
batch.

        OTOH, many solutions for problems like this, one must run a query
more than once. You could gen your pages w/ a button which would re-run
a given query, but w/ an integer offset which would be used to do a seek
against the current DB cursor.

        For example: after the 1st query has been performed, you
dynamically add a button which launches the same query, like this:
 
        (http://mypc.com/cgi-bin/lastSQLQuery?seek=10)

        At the bottom of the page that's gen'd from the GCI above is yet
another button which will take you to the next batch of records like:

        (http://mypc.com/cgi-bin/lastSQLQuery?seek=20)

        Hope this makes sense....Jet

=======================================================================
 The continued survival of the human race, despite its own stupidity,
 is the strongest argument for the existence of a benevolent God.
============================================================= Anon ====