[thelist] MySQL Total number of results with LIMIT set
Simon Perry
thelist at si-designs.co.uk
Thu May 26 11:15:26 CDT 2005
Hi,
Using PHP and MySQL I 'm trying to do the following;
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.
This is what I'm doing at the moment
Make a query (a join) that may return lots of results that I want to
limit to say 30 per page.
so I set LIMIT $start, $stop in the query
I need to know the total number of results but with LIMIT set I only
ever get the number in the current set returned by mysql_num_rows().
The only solution I can think of is to not set LIMIT and get the whole
result set every time and the control the pagination using purely PHP.
This seems a rather ugly and wasteful solution though.
Many thanks
Simon
More information about the thelist
mailing list