pg_Fetch_Array

Syntax

array pg_Fetch_Array(int result, int row);

Popis

Príkaz jazyka PHP
pg_Fetch_Array - fetch row as array

Returns: An array that corresponds to the fetched row, or false if there are no more rows.

pg_fetch_array is an extended version of pg_fetch_row. In addition to storing the data in the numeric indices of the result array, it also stores the data in associative indices, using the field names as keys.

An important thing to note is that using pg_fetch_array is NOT significantly slower than using pg_fetch_row, while it provides a significant added value.

Príklad

$conn = pg_pconnect("","","","","publisher");
if (!$conn) {
  echo "An error occured.\n";
  exit;
}
$result = pg_Exec ($conn, "SELECT * FROM authors");
if (!$result) {
  echo "An error occured.\n";
  exit;
}
$arr = pg_fetch_array ($result, 0);
echo $arr[0] . " <- array\n";
$arr = pg_fetch_array ($result, 1);
echo $arr["author"] . " <- array\n";


Pozri aj

pg_Fetch_Row