Back to the month index |
Back to the list index
|
Shane Caraveo (smc@siscony.com)
Mon, 20 Jan 1997 11:36:37 -0500
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
- Next message: Ally: "[mSQL] mSQL/Lisp"
- Previous message: Shane Caraveo: "Re: [mSQL] LITE and CGI"
- In reply to: Lukas Mesani: "[mSQL] LITE and CGI"
Message-Id: <199701201632.JAA04096@smtp.siscony.com> From: "Shane Caraveo" <smc@siscony.com> Date: Mon, 20 Jan 1997 11:36:37 -0500 Subject: Re: [mSQL] 2.0b[23] LIMIT problem?> >
> >Has anyone else had a problem with LIMIT not working? I thought I saw
> >something on the list recently, but can't find it. I've tested two
> d>ifferent machines, two different OS, and two completely different
> >databases, and on both, LIMIT has no effect - all rows are returned
> >regardless. Oh, yes, one is running 2.0b2, and one is running 2.0b3.
>
As I understand it, and correct me if I'm wrong please, what takes
the most time in a query is returning the data to the web browser.
LIMIT in v1 of msql did the query as if there was no LIMIT (ie.
getting all the records matching the query), but only returned X
number of records defined by the LIMIT to the browser.
What I've done to implement LIMIT is use a WHILE statement to only
echo the number of records I want returned to the user, and used a
variable to keep track of what record number is next, so the user can
get the next X-number of records. This reduces the number of records
returned, thus reducing the amount of time it takes the user to get
that data.
$start and $limit is passed to your script from a form:
<!
msqlQuery ($sock, "select * from database where recordnum > $start");
$res = msqlStoreResult();
$row = msqlFetchRow($res);
$start = "0";
$counter = 0;
while ( # $row != 0 && $counter < (int) $limit)
{
$counter = $counter + 1;
if ((int) $start < (int) $row[0]) {$start = $row[0];}
($row[0] SHOULD BE WHATEVER FIELD HAS RECORDNUMBER)
echo("You records information here");
$row = msqlFetchRow($res);
}
echo("Create another form here with $start and $limit and a submit
button to get next $limit number of records");
>
Hope this helps.
--------------------------------------------------------------------------
To remove yourself from the Mini SQL mailing list send a message containing
"unsubscribe" to "unsubscribe" to msql-list-request@bunyip.com. Send a message containing
"info msql-list" to majordomo@bunyip.com for info on monthly archives of
the list. For more help, mail owner-msql-list@bunyip.com NOT the msql-list!
- Next message: Ally: "[mSQL] mSQL/Lisp"
- Previous message: Shane Caraveo: "Re: [mSQL] LITE and CGI"
- In reply to: Lukas Mesani: "[mSQL] LITE and CGI"