Re: [SMARTY] Paging - a side note
| From: | Monte Ohrt | Date: | Thu, 12 Dec 2002 21:17:21 +0000 |
| Subject: | Re: [SMARTY] Paging - a side note | ||
| References: | 1 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-6782@lists.php.net to get a copy of this message | ||
For MySQL users, v4.0+ has functions CALC_FOUND_ROWS() and
SELECT_FOUND_ROWS() that does exactly what you want. But that doesn't
mean much regarding how it works with a template :-)
mysql> SELECT SQL_CALC_FOUND_ROWS * FROM tbl_name
WHERE id > 100 LIMIT 10;
mysql> SELECT FOUND_ROWS();
http://www.mysql.com/doc/en/Miscellaneous_functions.html
Monte
On Thu, 2002-12-12 at 13:18, Yrjö Mäenpää wrote:
> Pagination is indeed an interesting topic.
>
> The suggestions I have read all seem to depend on knowing the row count of the query result. I
> have a database of about 1.5 million records and i have to paginate complex search results. If I
> were to use num_rows or count(*) first, my searches would far too slow. So I have to use limit (with
> offset and rows) and to get only 20 matching record at the time not knowing how many there will be.
>
> If someone (Ben Phillips him self perhaps) would write a plugin to this kind of a situation, at
> least I would be very happy (regardles of where the logic is :)
>
> greetings,
> Yrjo
--
Monte Ohrt <monte@ispi.net>