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
2025-01-10 15:47:30
Comments
Leave a Comment

Please login to continue.