Code: Select all
$result = mysql_query ("SELECT * FROM samples WHERE (status = 'closed') GROUP BY userid ORDER BY dateadded ASC LIMIT $offset, $rowsPerPage");
----
SELECT COUNT(id) AS numrows FROM samples WHERE (status = 'closed')
I have a page that lists requests from people. The top query finds each 'group' of requests individuals, but because there are so many, I need to put it into pages. So, the second query is part of the page number bit - but it won't work, because as it stands, it will show 2017 rows - when 'grouped' there aren't that many, because 10 requests from one person, shows as 1 in the upper query.
So I need to get the full num rows, from the top count.
How do I do that, in the second query?