★ wanayoo — archive 1999 http://www.php.net/manual/es/function.pg-fetch-array.phpNouvelle recherche | Portail wanayoo

PHP Home Page

Manual Table of Contents
Up to PostgreSQL
Quick Reference
PostgreSQL
English version of this pageGerman version of this pageJapanese version of this page
Italian version of this pageFrench version of this pageHungarian version of this page
Spanish version of this pageDutch version of this page
* pg_Close
* pg_cmdTuples
* pg_Connect
* pg_DBname
* pg_ErrorMessage
* pg_Exec
* pg_Fetch_Array
* pg_Fetch_Object
* pg_Fetch_Row
* pg_FieldIsNull
* pg_FieldName
* pg_FieldNum
* pg_FieldPrtLen
* pg_FieldSize
* pg_FieldType
* pg_FreeResult
* pg_GetLastOid
* pg_Host
* pg_loclose
* pg_locreate
* pg_loopen
* pg_loread
* pg_loreadall
* pg_lounlink
* pg_lowrite
* pg_NumFields
* pg_NumRows
* pg_Options
* pg_pConnect
* pg_Port
* pg_Result
* pg_tty

  Thanks to:
 Chek.com
 easyDNS
 VA Linux Systems

  Related sites:
Apache
MySQL
PostgreSQL
Zend Tech.

  Community:
LinuxFund.org
OSDN
Manual: pg_Fetch_Array
View the source code for this pageSearch the site



Previous page
 pg_Exec
 Updated
Tue, 21 Nov 2000
pg_Fetch_Object 
Next page


pg_Fetch_Array

(PHP 3>= 3.0.1, PHP 4 )

pg_Fetch_Array -- obtiene una fila en la forma de un array

Descripción

array pg_fetch_array (int result, int row [, int result_type])

Devuelve: Un array que se corresponde con la fila obtenida, o false si no hay más filas.

pg_fetch_array() es una versión extendida de pg_fetch_row(). Además de almacenar los datos en los índices numericos del array resultante, también almacena los datos usando índices asociativos, empleando para ello el nombre del campo como la llave o índice.

El tercer parámetro opcional result_type en pg_fetch_array() es una constante y puede tomar cualquiera de los siguientes valores: PGSQL_ASSOC, PGSQL_NUM, y PGSQL_BOTH.

Nota: Result_type se añadio en PHP 4.0.

Una cosa importante a tener en cuenta es que usar pg_fetch_array() NO es significativamente más lento que usar pg_fetch_row(), y sin embargo el valor añadido que aporta sí lo es.

Para más detalles, ver pg_fetch_row()

Ejemplo 1. PostgreSQL fetch array


<?php 
$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";
?>
     

 About Notes


Previous page
 pg_Exec
 Updated
Tue, 21 Nov 2000
pg_Fetch_Object 
Next page





Who's responsible for this?
Top of this page

Site
Hosting:



Located in
United States
Elements of this website are subject to copyright.
Questions about installing or using PHP should be directed to one of the mailing lists.
Only questions about the website should be directed to webmaster@php.net.