Possible Duplicate:
Is is possible to set a default PDO fetch mode?
I have searched the internet and this site and could not find an solution.
Is there a way to apply $this->query->setFetchMode(PDO::FETCH_ASSOC);
globally for all PDO queries? I find myself repeating the line over and over again.
I have tried applying it to the initial PDO
connection: $this->connection->setFetchMode()
but that throws an exception.
Since 5.2
$pdo->setAttribute(PDO::ATTR_DEFAULT_FETCH_MODE, PDO::FETCH_ASSOC);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With