Re: PDO user question

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



That's how I'd do it. Extend the PDO interface on your abstract class to include a "num_rows()" method that utilizes that higher level count($this->result). It might be a little more overhead... but RAM is cheap... and there's always forking/extending the library in C/C++...

-Brandon

On 2012-09-09 11:49, Michael Stowe wrote:
How are you using the number?  Probably the easiest way is to utilize
PDOStatement::FetchAll() and then do a count() on that result set.

- Mike



Sent from my iPhone

On Sep 9, 2012, at 11:42 AM, Stefan Wixfort <stefan.wixfort@xxxxxx> wrote:

Hi Jim

I've had some success with querying using pdo and prepared statements as
well.  One thing that I'm curious about is

How does one handle the need to get the number of rows returned by a Select? The documentation is very clear that PDO doesn't return that value for a Select statement (depending upon driver?) and there were a couple of solutions that made no sense to me. There was even one that did a completely separate query just to get the row count which makes
even less sense.

I believe you are referring to "SELECT COUNT(*)..."
Because I couldn't find a different way I use that.

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux