downloads | documentation | faq | getting help | mailing lists | reporting bugs | php.net sites | links | my php.net 
search for in the  

<pg_fetch_all_columnspg_fetch_array>
Last updated: Thu, 26 Jun 2008

pg_fetch_all

(PHP 4 >= 4.3.0, PHP 5)

pg_fetch_all — Fetches all rows from a result as an array

Description

array pg_fetch_all ( resource $result )

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

Note: This function sets NULL fields to the PHP NULL value.

Parameters

result

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

Return Values

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.

Examples

Example #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);

var_dump($arr);

?>



add a noteadd a note User Contributed Notes
Fetches all rows from a result as an array
There are no user contributed notes for this page.




<pg_fetch_all_columnspg_fetch_array>
Last updated: Thu, 26 Jun 2008
show source | credits | sitemap | contact | advertising | mirror sites
Copyright © 2001-2005 The PHP Group
All rights reserved.
This unofficial mirror is operated at: http://phpbuilder.com/
Last updated: Tue Nov 1 20:20:59 2005 EST
Columns / Articles | Tips / Quickies | News | News Linking and RSS Feeds | Shared Code Library
Mail Archives | Support / Discussion Forums | Get Started! Links | Contribute! | Docs