Not without actually performing SOME kind of query.  You could

select count(*) from...

and insert the rest of your query there.  This would give you the count.
Then store this in a session variable (PHP) for subsequent pages.

Most of the time though, I just put a NEXT button.  ADODB has some great
pagination tools to make this stuff easy.

=C=

*
* Cal Evans
* The Virtual CIO
* http://www.calevans.com
*


-----Original Message-----
From: Walter D. Funk [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, July 16, 2002 9:02 AM
To: [EMAIL PROTECTED]
Subject: Calculating rows in a result set


Hi everybody,

is there a way to calculate the number of rows retrieved by a mysql query,
without actually performing it?

I want to make a paginated result like in most search engines, and for that
I need to display the number of pages
the result would have, but I do not want to actually retrieve all the rows
to be able to count them, because this is
a loss of performance, in particular if the result set retrieves 100000 rows
and 100 people make a search; this would
end in 10000 x 100 rows just to say how many pages the result will have, I
think there must be a better way to do it, isn't it?

thanks to everybody in advance
W.D.F.





---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php



---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to