On 9/8/2012 2:02 PM, Jim Giner wrote:
I finally delved into learning how I was going to replace my MYSQL calls
with a different interface. Had to go with PDO since my hoster doesn't
support MYSQLI for my plan.
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.
Will PDO ever come up with an accurate row count function?
Does someone have a tried and true snippet they can share?
For those looking for the answer to my question also, I've learne dthat
this will work for 'small' result sets. My applications do not make
requests for large result sets, so this works fine.
$rows = $qrslts->fetchAll(PDO::FETCH_ASSOC);
echo count($rows)." results found<br>";
I suppose if I ever write up a new appl that will have to handle large
query results, I'll have to come up with something else.
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php