[thelist] MySQL Total number of results with LIMIT set

Phil Turmel philip at turmel.org
Thu May 26 12:24:57 CDT 2005


Paul Waring wrote:
> On 5/26/05, Simon Perry <thelist at si-designs.co.uk> wrote:
> 
>>In short I would like to be able to display that there are, say, '374'
>>matches split over '13' pages but I just can't seem to get the number of
>>matches.

> 
> There may be a built-in MySQL function to count the number of rows in
> a given table other than using COUNT() but I don't know of one.
> 

Actually, since MySQL 4.0, you can check FOUND_ROWS() after a query to 
determine how many would have been returned if no LIMIT was specified.

Details here:
http://dev.mysql.com/doc/mysql/en/information-functions.html

HTH,

Phil



More information about the thelist mailing list