php3-list | 199903
Date: 03/08/99
- Next message: Sander Pilon: "[PHP3] Semaphores"
- Previous message: Michael Stearne: "Re: [PHP3] it helps again"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
<?
$rtnrecs=10; // get 10 at a time
$conn=mysql_connect("localhost","user","pwd");
$row=$HTTP_COOKIE_VARS["row"]; // get last record pointer
if ($row=""");
{
$row=0;
}
setCookie("row", ($row+$rtnrecs),0,"/",$SERVER_NAME,0); //increment pointer
by # returned
$sqlstr="SELECT * from table LIMIT ".$row,",".$numrecs;
$result=mysql_db_query("dB",$sqlstr,$conn);
?>
You can call this from a form that has Prev, Next, Same buttons to
manuipulate the record pointer and navigate thru the recordset. I have an
example of this if you are interested as well. This simulates the Micro$oft
Active Server Pages 'recordset' object as best I could...it works and the
server doesn't seem to take a performance hit.
-----Original Message-----
From: Sam Goin [mailto:samgoin <email protected>]
Sent: Monday, March 08, 1999 2:25 PM
To: Daniel Lashua
Cc: php3 <email protected>
Subject: Re: [PHP3] 10 query results at a time...
Thanks. Does anybody have an example script for getting 10 results at a
time?
Thanks,
Sam Goin
-----Original Message-----
From: Daniel Lashua <daniel.lashua <email protected>>
To: Sam Goin <samgoin <email protected>>
Cc: php3 <email protected> <php3 <email protected>>
Date: Monday, March 08, 1999 10:09 AM
Subject: Re: [PHP3] 10 query results at a time...
>Well... depends on.... faster overall would be to get all the records
>and have PHP parse them... however, the initial request will take longer
>than the small 10 row requests would take. So... are you looking for
>overall speed, or speed in between each page? If you don't mind having
>your users wait a while for the first request, it is probably best to
>get it all at once, and throw it in a flat file or in shared memory or
>something, and then retrieve it piece by piece as needed.
>
>Daniel
>
>
>Sam Goin wrote:
>>
>> Hello,
>>
>> I have 2 questions.
>>
>> 1. Would it be faster for the client to get a semi-large query result,
and
>> then use php3 to display 10 rows from the result at a time, or would it
be
>> faster to query the database 10 rows at a time?
>>
>> I am using Apache 1.3.4 and MySQL. The results from each row would be
less
>> than 15 KB, and the total result would be no more than 300 rows.
>>
>> 2. Can you give me an example code for the answer to #1?
>>
>> Thanks,
>>
>> Sam Goin
>>
>> --
>> PHP 3 Mailing List http://www.php.net/
>> To unsubscribe send an empty message to php3-unsubscribe <email protected>
>> To subscribe to the digest list: php3-digest-subscribe <email protected>
>> For help: php3-help <email protected> Archive:
http://www.php.net/mailsearch.php3
>> List administrator: zeev-list-admin <email protected>
>
-- PHP 3 Mailing List http://www.php.net/ To unsubscribe send an empty message to php3-unsubscribe <email protected> To subscribe to the digest list: php3-digest-subscribe <email protected> For help: php3-help <email protected> Archive: http://www.php.net/mailsearch.php3 List administrator: zeev-list-admin <email protected>-- PHP 3 Mailing List http://www.php.net/ To unsubscribe send an empty message to php3-unsubscribe <email protected> To subscribe to the digest list: php3-digest-subscribe <email protected> For help: php3-help <email protected> Archive: http://www.php.net/mailsearch.php3 List administrator: zeev-list-admin <email protected>
- Next message: Sander Pilon: "[PHP3] Semaphores"
- Previous message: Michael Stearne: "Re: [PHP3] it helps again"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

