Work-around for PHP5's PDO rowCount MySQL issue

Posted by Steven Surowiec on Stack Overflow See other posts from Stack Overflow or by Steven Surowiec
Published on 2009-01-20T03:15:59Z Indexed on 2010/03/27 0:43 UTC
Read the original article Hit count: 372

Filed under:
|

I've recently started work on a new project using PHP5 and want to use their PDO classes for it. The problem is that the MySQL PDO Driver doesn't support rowCount() so there's no way to run a query and then get the number of affected rows, or rows returned, which is a pretty big issue as far as I'm concerned. I was wondering if anyone else has dealt with this before and what you've done to work around it. Having to do a fetch() or fetchAll() to check if any rows were affected or returned seems like a hack to me, I'd rather just do $stmt->numRows() or something similar.

© Stack Overflow or respective owner

Related posts about php

Related posts about pdo