PDOStatement::fetch(PHP 5 >= 5.1.0, PECL pdo >= 0.1.0) PDOStatement::fetch — Fetches the next row from a result set Описание
mixed PDOStatement::fetch
([ int $fetch_style
[, int $cursor_orientation = PDO::FETCH_ORI_NEXT
[, int $cursor_offset = 0
]]] )
Fetches a row from a result set associated with a PDOStatement object. The fetch_style parameter determines how PDO returns the row. Список параметров
Возвращаемые значенияThe return value of this function on success depends on the fetch type. In all cases, FALSE is returned on failure. Примеры
Пример #1 Fetching rows using different fetch styles
<?phpРезультат выполнения данного примера:
PDO::FETCH_ASSOC: Return next row as an array indexed by column name
Array
(
[NAME] => apple
[COLOUR] => red
)
PDO::FETCH_BOTH: Return next row as an array indexed by both column name and number
Array
(
[NAME] => banana
[0] => banana
[COLOUR] => yellow
[1] => yellow
)
PDO::FETCH_LAZY: Return next row as an anonymous object with column names as properties
PDORow Object
(
[NAME] => orange
[COLOUR] => orange
)
PDO::FETCH_OBJ: Return next row as an anonymous object with column names as properties
kiwi
Пример #2 Fetching rows with a scrollable cursor
<?phpРезультат выполнения данного примера: Reading forwards: 21 10 5 16 0 5 19 20 10 Reading backwards: 19 20 10 16 0 5 21 10 5 Смотрите также
|
||