Db\Result\Pdo::setFetchMode

public setFetchMode (mixed $fetchMode, [mixed $colNoOrClassNameOrObject], [mixed $ctorargs])

Changes the fetching mode affecting Phalcon\Db\Result\Pdo::fetch()

//Return array with integer indexes
$result->setFetchMode(\Phalcon\Db::FETCH_NUM);

//Return associative array without integer indexes
$result->setFetchMode(\Phalcon\Db::FETCH_ASSOC);

//Return associative array together with integer indexes
$result->setFetchMode(\Phalcon\Db::FETCH_BOTH);

//Return an object
$result->setFetchMode(\Phalcon\Db::FETCH_OBJ);
doc_Phalcon
2016-10-16 09:49:52
Comments
Leave a Comment

Please login to continue.