Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

PDOStatement::fetchObject

PDOStatement::fetchObject

PHP PDO Reference ManualPHP PDO Reference Manual

PDOStatement::fetchObject — Fetches the next row and returns it as an object. (PHP 5 >= 5.1.0, PECL pdo >= 0.2.4)


Description

Syntax



mixed PDOStatement::fetchObject ([ string $class_name = "stdClass" [, array $ctor_args ]] )

Fetches the next row and returns it as an object. This function (method) is an alternative to using the PDO::FETCH_CLASS or PDO::FETCH_OBJ style of PDOStatement::fetch().


Parameters

** class_name**

The name of the class to create.

** ctor_args**

The elements of this array are passed to the constructor.


Return Value

Returns an instance of the requested class whose property names correspond to the column names, or FALSE on failure.


PHP PDO Reference ManualPHP PDO Reference Manual