RE: [PHP-DB] LIMIT and get_num_rows
| From: | matt stewart | Date: | Mon, 14 Jan 2002 11:06:45 +0000 |
| Subject: | RE: [PHP-DB] LIMIT and get_num_rows | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-15754@lists.php.net to get a copy of this message | ||
but presumably if i'm doing a SELECT count(*) FROM Designs WHERE Keywords
LIKE "%sport%"
followed by a SELECT * FROM Designs WHERE Keywords LIKE "%sport%" LIMIT 0,20
it's still using nearly as much processing time as just returning all the
designs and just using a get_num_rows and then only using the first 20?
-----Original Message-----
From: Jonatan Bagge [mailto:jb@material.uu.se]
Sent: 14 January 2002 11:00
To: matt stewart
Subject: Re: [PHP-DB] LIMIT and get_num_rows
First do a SELECT count(*) from tablename;
This will get the number of entries...
The rest should be simple...
matt stewart wrote:
hi guys, just looking for verification on this, as i don't think there's any
way to do it....
Basically, i want to return the results for a search, but only return the
first 20 results from the start number given....
LIMIT $start, 20
BUT... i'd like to have a page 1-whatever so if there are 65 results in
total, then the first 20 will be shown, but there will be options to move to
pages 2,3 or 4.
Obviously, if i use LIMIT, then it won't know that there are 65 in total, so
how would i get around this? do i just have to do the full query, and then
only use the first 20 results in the results set?
just becomes a bit of a problem if there are, say, 8000 results returned!
would it just be best to return the first 200 using LIMIT, and do my pages
for those, with a note that there are more than 200 results, and to refine
the search criteria?
Cheers,
Matt
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system ( HYPERLINK
"http://www.grisoft.com"http://www.grisoft.com).
Version: 6.0.313 / Virus Database: 174 - Release Date: 02/01/02
--
PHP Database Mailing List ( HYPERLINK
"http://www.php.net/"http://www.php.net/)
To unsubscribe, e-mail: php-db-unsubscribe@lists.php.net
For additional commands, e-mail: php-db-help@lists.php.net
To contact the list administrators, e-mail: php-list-admin@lists.php.net
---
Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.313 / Virus Database: 174 - Release Date: 02/01/02
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.313 / Virus Database: 174 - Release Date: 02/01/02