|
update : 2015.11.03
php.shukuma.com검색:
|
PDOStatement::fetch(PHP 5 >= 5.1.0, PECL pdo >= 0.1.0) PDOStatement::fetch — Fetches the next row from a result set 설명
public 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
인수
반환값
The return value of this function on success depends on the fetch type. In
all cases, 예제
Example #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
Example #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 참고
|