|
Posted by Captain Paralytic on 06/13/07 09:52
On 13 Jun, 10:00, "cluthz" <WHATEEVVE...@by.co.uk> wrote:
> Hi there,
>
> I have query which returns to many results to handle (therefore to be
> displayed screen at one time and to be transferred from the server).
>
> I therefore want to create a search results screen which displays a limited
> subset of query results and the user of the application can control which
> subset of results are displayed (e.g. say there are 10000 matching results,
> the user can see results 1-500, and move on in batches of 500).
>
> The only thing is, to get the amount of rows I still have to run a very
> similar (and therefore big) MySQL query as if I was getting all 10000
> results, just to find out how many results there actually are.
>
> So am I right in thinking this is the way to go about it. Therefore I run
> the query once but only ask for a count of results to be returned. This
> gives me the total amount of matches.
> Then I run the query again, this time returning all the fields information,
> but this time I use LIMIT to restrict the actual results.
>
> I hope this question makes sense and thanks in advance for any input.
Take a look at:
http://dev.mysql.com/doc/refman/5.0/en/information-functions.html#function_found-rows
Navigation:
[Reply to this message]
|