Re: PDO user question
| From: | Lester Caine | Date: | Sun, 09 Sep 2012 19:00:53 +0000 |
| Subject: | Re: PDO user question | ||
| References: | 1 2 3 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-48471@lists.php.net to get a copy of this message | ||
Michael Stowe wrote:
How are you using the number? Probably the easiest way is to utilize PDOStatement::FetchAll() and then do a count() on that result set.There are two things to bear in mind here. Often you are only displaying a subset of records - ten per page perhaps - and so a count of the total helps to populate the navigation tools. COUNT(*) is not the most efficient way of doing that when dealing with large numbers of records, and so keeping a table with a set of counters that are populated via triggers on insert and delete help to speed up that process. FetchAll() should then always produce a full set of records except for the last page ... -- Lester Caine - G8HFL ----------------------------- Contact - http://lsces.co.uk/wiki/?page=contact L.S.Caine Electronic Services - http://lsces.co.uk EnquirySolve - http://enquirysolve.com/ Model Engineers Digital Workshop - http://medw.co.uk Rainbow Digital Media - http://rainbowdigitalmedia.co.uk