easydb
easydb copied to clipboard
setAttribute not working
hello i am trying to change the default fetch mod to : object using:
$db->setAttribute(PDO::ATTR_DEFAULT_FETCH_MODE, PDO::FETCH_OBJ);
but there is no effects on the result, its still return results as an array.
also trying to use this options: `$db_connection_attributes = [ PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES 'utf8'",
PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_OBJ ]; `
like this :
$db = \ParagonIE\EasyDB\Factory::fromArray([ 'mysql:host='.TDB_HOST.';dbname='.TDB_NAME, TDB_USER, TDB_PASS ], '', $db_connection_attributes);
dose not work also..
What method are you using to get results as an array?
Most of EasyDB's APIs explicitly return an array, always, regardless of what PDO is configured to do. Check the docblocks for the methods you intend to use.
Please let us know if you're still having problems.