ResultStatement
extends
Traversable
in
Interface for the reading part of a prepare statement only.
Tags
Table of Contents
- closeCursor() : bool
- Closes the cursor, enabling the statement to be executed again.
- columnCount() : int
- Returns the number of columns in the result set
- fetch() : mixed
- Returns the next row of a result set.
- fetchAll() : array<string|int, mixed>
- Returns an array containing all of the result set rows.
- fetchColumn() : string|bool
- Returns a single column from the next row of a result set or FALSE if there are no more rows.
- setFetchMode() : bool
- Sets the fetch mode to use while iterating this statement.
Methods
closeCursor()
Closes the cursor, enabling the statement to be executed again.
public
closeCursor() : bool
Return values
bool —TRUE on success or FALSE on failure.
columnCount()
Returns the number of columns in the result set
public
columnCount() : int
Return values
int —The number of columns in the result set represented by the PDOStatement object. If there is no result set, this method should return 0.
fetch()
Returns the next row of a result set.
public
fetch([int|null $fetchMode = null ]) : mixed
Parameters
- $fetchMode : int|null = null
-
Controls how the next row will be returned to the caller. The value must be one of the PDO::FETCH_* constants, defaulting to PDO::FETCH_BOTH.
Tags
Return values
mixed —The return value of this method on success depends on the fetch mode. In all cases, FALSE is returned on failure.
fetchAll()
Returns an array containing all of the result set rows.
public
fetchAll([int|null $fetchMode = null ]) : array<string|int, mixed>
Parameters
- $fetchMode : int|null = null
-
Controls how the next row will be returned to the caller. The value must be one of the PDO::FETCH_* constants, defaulting to PDO::FETCH_BOTH.
Tags
Return values
array<string|int, mixed> —fetchColumn()
Returns a single column from the next row of a result set or FALSE if there are no more rows.
public
fetchColumn(int $columnIndex) : string|bool
Parameters
- $columnIndex : int
-
0-indexed number of the column you wish to retrieve from the row. If no value is supplied, PDOStatement->fetchColumn() fetches the first column.
Return values
string|bool —A single column in the next row of a result set, or FALSE if there are no more rows.
setFetchMode()
Sets the fetch mode to use while iterating this statement.
public
setFetchMode(int $fetchMode[, mixed $arg2 = null ][, mixed $arg3 = null ]) : bool
Parameters
- $fetchMode : int
-
The fetch mode must be one of the PDO::FETCH_* constants.
- $arg2 : mixed = null
- $arg3 : mixed = null