php-pdo

PHP PDO: Differences between the methods of retrieving a single-column result.

What's the difference between $PDOStatement->fetchColumn(); and $PDOStatement->fetch(PDO::FETCH_COLUMN); (if one exists)? Or are they functionally similar but only aesthetically different? ...

Count with PDO

There are many conflicting statements around, what is the best way to row count using PDO in PHP with MySQL? Before using PDO I just simply used mysql_num_rows. FetchAll is something I won't want as I may sometimes be dealing with large datasets, so not good for my use. Any suggestions? ...

Is is possible to set a default PDO fetch mode?

Before I retrieve data I always have to type: $STH->setFetchMode(PDO::FETCH_OBJ); In the interest of making my code more readable it would be great if I could set a default mode somewhere.... Thanks! Edit. I was originally hoping I could add PDO:FETCH_OBJ to the setAttribute code I run when I connect to the DB, but that doesn't seem...