Description
pdostatement::fetch- Gets the next row from a result set related to a Pdostatement object. fetch_style
parameter determines how the POD returns rows.
Parameters
fetch_style
Controls how the next row is returned to the caller. This value must be one of the pdo::fetch_* series constants, which defaults to pdo::attr_default_fetch_mode (default = Pdo::fetch_both ).
pdo::fetch_bound: Returns TRUE
and assigns the column values in the result set to the PHP variable bound to the Pdostatement::bindcolumn () method.
Pdo::fetch_class: Returns a new instance of the request class that maps the column names in the result set to the corresponding property names in the class. If fetch_style
Pdo::fetch_classtype is included (for example:pdo::fetch_class | Pdo::fetch_classtype), the class name is determined by the value of the first column
pdo::fetch_into: Updating an instance of a requested class that already exists, mapping columns in the result set to properties named in the class
pdo::fetch_lazy: Using pdo::fetch_both and pdo::fetch_objtogether to create object variable names for access
Cursor_orientation
For a scrollable cursor represented by a Pdostatement object, this value determines which row will be returned to the caller. This value must be one of the pdo::fetch_ori_* series constants, and the default is Pdo::fetch_ori_next. For a Pdostatement object to use a scrollable cursor, you must preprocess the SQL statement with PDO::p Repare () and set the pdo::attr_cursor property to Pdo::cursor_scroll .
offset
For a scrollable cursor represented by a Pdostatement object with the cursor_orientation parameter set to pdo::fetch_ori_abs , this value specifies the absolute line number in the result set that you want to get the row.
For a scrollable cursor represented by a Pdostatement object that is set to Pdo::fetch_ori_rel for a cursor_orientation parameter, this value specifies that the row is to be fetched relative to the calling Position of the cursor before pdostatement::fetch ()
return value
The value returned when this function (method) succeeds depends on the fetch type. In all cases, the failure is returned FALSE
.
Pdostatement::fetch