pg_result_seek
(PHP 4 >= 4.3.0, PHP 5, PHP 7, PHP 8)
g_result_seek - 결과 인스턴스에서 내부 행 오프셋 설정
설명
pg_result_seek(PgSql\Result $result
, int $row
): bool
pg_result_seek()는 result
인스턴스의 내부 행 오프셋을 설정합니다.
매개변수
result
- pg_query(), pg_query_params() 또는 pg_execute()(특히)에 의해 반환된 PgSql\Result 인스턴스.
row
- PgSql\Result 인스턴스에서 내부 오프셋을 이동할 행입니다. 행은 0부터 시작하여 번호가 매겨집니다.
반환 값
성공하면 true
를, 실패하면 false
를 반환합니다.
변경 로그
버전 | 설명 |
---|---|
8.1.0 | result 매개변수는 이제 PgSql\Result 인스턴스를 예상합니다. 이전에는 resource가 필요했습니다. |
Examples
예제 #1 pg_result_seek() 예제
<?php
// Connect to the database
$conn = pg_pconnect("dbname=publisher");
// Execute a query
$result = pg_query($conn, "SELECT author, email FROM authors");
// Seek to the 3rd row (assuming there are 3 rows)
pg_result_seek($result, 2);
// Fetch the 3rd row
$row = pg_fetch_row($result);
?>
기타
- pg_fetch_row() - 열거형 배열로 행 가져오기
- pg_fetch_assoc() - 행을 연관 배열로 가져오기
- pg_fetch_array() - 행을 배열로 가져오기
- pg_fetch_object() - 행을 객체로 가져오기
- pg_fetch_result() - 결과 인스턴스에서 값을 반환합니다.