DroidOS
DroidOS

Reputation: 8890

mySQL SELECT PDOStatement->rowCount

I am just wondering what the definitive answer to this question is. The PHP PDO documentation warns that PDOStatement->rowCount cannot be relied up to return the number of rows "affected" with a SELECT statement. And yet I find that this continues to work perefectly with mySQL + PHP version after version. Perhaps there is an issue when using another DB but if I don't ever want to migrate to another DB should I really care?

Upvotes: 2

Views: 1566

Answers (1)

Fad
Fad

Reputation: 9858

Yes, you should still care about the usage of that method. It's not just the database, but PHP itself can be a problem.

If you want to play it safe, it's better if you just issue a SELECT COUNT(*) instead.

Upvotes: 2

Related Questions