Best way to tell how many rows a query returns
| From: | Ross Honniball | Date: | Wed, 12 May 2004 08:30:48 +0000 |
| Subject: | Best way to tell how many rows a query returns | ||
| Groups: | php.windows | ||
| Request: | Send a blank email to php-windows+get-23680@lists.php.net to get a copy of this message | ||
Hi folks,
I'm using a mysql query with a LIMIT clause. The problem is I would like to know how many rows WOULD have matched had the limit clause not been in place. I realise that any solution is going to involve some over-head, but what's the most efficient way to find out?
eg.
SELECT * FROM table WHERE conditions LIMIT 30,30
Say there are 200 records that match 'conditions', only 30 rows are returned (of course). How do I find out the total number (200 in this case) that matched the conditions?
Any ideas?
. Ross Honniball JCU Bookshop Cairns Supervisor. James Cook Uni, McGreggor Rd, Smithfield, Qld. 4878, Australia . Ph:07.4042.1157 Fx:07.4042.1158 Em:ross@bookshop.jcu.edu.au . There are no problems. Only solutions.