downloads | documentation | faq | getting help | mailing lists | licenses | wiki | reporting bugs | php.net sites | conferences | my php.net

search for in the

pg_fetch_array> <pg_fetch_all_columns
[edit] Last updated: Fri, 30 Nov 2012

view this page in

pg_fetch_all

(PHP 4 >= 4.3.0, PHP 5)

pg_fetch_allFetches all rows from a result as an array

Opis

array pg_fetch_all ( resource $result )

pg_fetch_all() returns an array that contains all rows (records) in the result resource.

Informacja: Ta funkcja ustala wartość pól NULL na NULL.

Parametry

result

PostgreSQL query result resource, returned by pg_query(), pg_query_params() or pg_execute() (among others).

Zwracane wartości

An array with all rows in the result. Each row is an array of field values indexed by field name.

FALSE is returned if there are no rows in the result, or on any other error.

Przykłady

Przykład #1 PostgreSQL fetch all

<?php 
$conn 
pg_pconnect("dbname=publisher");
if (!
$conn) {
    echo 
"An error occured.\n";
    exit;
}

$result pg_query($conn"SELECT * FROM authors");
if (!
$result) {
    echo 
"An error occured.\n";
    exit;
}

$arr pg_fetch_all($result);

print_r($arr);

?>

Powyższy przykład wyświetli coś podobnego do:

Array
(
    [0] => Array
        (
            [id] => 1
            [name] => Fred
        )

    [1] => Array
        (
            [id] => 2
            [name] => Bob
        )

)

Zobacz też:



pg_fetch_array> <pg_fetch_all_columns
[edit] Last updated: Fri, 30 Nov 2012
 
add a note add a note User Contributed Notes pg_fetch_all - [8 notes]