Manuel PHP

Précédent

 

Suivant

pg_Fetch_Row

pg_Fetch_Row -- Lit une ligne dans un tableau

Description

array pg_fetch_row(int result, int row);

Retourne un tableau qui contient les données de la ligne demandées, ou false, si il ne reste plus de lignes.

pg_fetch_row() lit une ligne dans le résultat associé à l'index result. La ligne est retournée sous la forme d'un tableau énuméré. fetches one row of data from the result associated with the specified result identifier. La ligne est retournée sous la forme d'un tableau, qui commence à l'index 0.

Les appels ultérieurs à pg_fetch_row() retourneont la ligne d'après, ou bien false, lorsqu'il n'y aura plus de lignes.

Voir aussi: pg_fetch_array(), pg_fetch_object(), pg_result().

Exemple 1. Postgres fetch row

<?php 
$conn = pg_pconnect("","","","","publisher");
if (!$conn) {
    echo "Erreur.\n";
    exit;
}

$result = pg_Exec ($conn, "SELECT * FROM authors");
if (!$result) {
    echo "Erreur.\n";
    exit;
}

$row = pg_fetch_row ($result, 0);
echo $row[0] . " <- row\n";

$row = pg_fetch_row ($result, 1);
echo $row[0] . " <- row\n";

$row = pg_fetch_row ($result, 2);
echo $row[1] . " <- row\n";
?>

Précédent

Sommaire

Suivant

pg_Fetch_Object

Chapitre

pg_FieldIsNull