PHP.nl

pg_fetch_row

pg_fetch_row

Get a row as an enumerated array

 **pg_fetch_row** PgSql\Result $result  $row int $mode
fetches one row of data from

the result associated with the specified instance. pg_fetch_row``result

result``rowRow number in result to fetch. Rows are numbered from 0 upwards. If omitted or null, the next row is fetched.

mode

An , indexed from 0 upwards, with each value represented as a . Database values are returned as null. array``string``NULL

false is returned if exceeds the number of rows in the set, there are no more rows, or on any other error. row

Voorbeeld: example

<?php

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

$result = pg_query($conn, "SELECT author, email FROM authors");
if (!$result) {
  echo "An error occurred.\n";
  exit;
}

while ($row = pg_fetch_row($result)) {
  echo "Author: $row[0]  E-mail: $row[1]";
  echo "<br />\n";
}
 
?>

pg_query``pg_fetch_array``pg_fetch_object``pg_fetch_result