hakkr has asked for the wisdom of the Perl Monks concerning the following question:
I use the Mysql LIMIT clause to return the required number of records( X to Y from total) for a results list page. LIMIT however sets $qh->rows to the number of rows you specify so I have to do a another query omitting the LIMIT clause to get the real total. This means all searchs take 2 queries as below
return first 10 recs and total =10
SELECT field FROM table WHERE text='test' LIMIT 1,10
returns the real total
SELECT count(*) FROM table WHERE text='test'
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Theres no LIMIT
by Masem (Monsignor) on Dec 14, 2001 at 17:05 UTC | |
|
Re: Theres no LIMIT
by dug (Chaplain) on Dec 14, 2001 at 19:29 UTC |