<HTML ><HEAD ><TITLE >pg_Fetch_Row</TITLE ><META NAME="GENERATOR" CONTENT="Modular DocBook HTML Stylesheet Version 1.44"><LINK REL="HOME" TITLE="PHP Manual" HREF="manual.html"><LINK REL="UP" TITLE="PostgreSQL functions" HREF="ref.pgsql.html"><LINK REL="PREVIOUS" TITLE="pg_Fetch_Object" HREF="function.pg-fetch-object.html"><LINK REL="NEXT" TITLE="pg_FieldIsNull" HREF="function.pg-fieldisnull.html"></HEAD ><BODY BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#840084" ALINK="#0000FF" ><DIV CLASS="NAVHEADER" ><TABLE WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" ><TR ><TH COLSPAN="3" ALIGN="center" >PHP Manual</TH ></TR ><TR ><TD WIDTH="10%" ALIGN="left" VALIGN="bottom" ><A HREF="function.pg-fetch-object.html" >Prev</A ></TD ><TD WIDTH="80%" ALIGN="center" VALIGN="bottom" ></TD ><TD WIDTH="10%" ALIGN="right" VALIGN="bottom" ><A HREF="function.pg-fieldisnull.html" >Next</A ></TD ></TR ></TABLE ><HR ALIGN="LEFT" WIDTH="100%"></DIV ><H1 ><A NAME="function.pg-fetch-row" >pg_Fetch_Row</A ></H1 ><DIV CLASS="refnamediv" ><A NAME="AEN24043" ></A >pg_Fetch_Row -- get row as enumerated array</DIV ><DIV CLASS="refsect1" ><A NAME="AEN24046" ></A ><H2 >Description</H2 ><DIV CLASS="funcsynopsis" ><P ></P ><CODE CLASS="FUNCDEF" >array pg_fetch_row</CODE >(int result, int row);<P ></P ></DIV ><P > Returns: An array that corresponds to the fetched row, or false if there are no more rows. </P ><P > <B CLASS="function" >pg_fetch_row()</B > fetches one row of data from the result associated with the specified result identifier. The row is returned as an array. Each result column is stored in an array offset, starting at offset 0. </P ><P > Subsequent call to <B CLASS="function" >pg_fetch_row()</B > would return the next row in the result set, or false if there are no more rows. </P ><P > See also: <A HREF="function.pg-fetch-array.html" ><B CLASS="function" >pg_fetch_array()</B ></A >, <A HREF="function.pg-fetch-object.html" ><B CLASS="function" >pg_fetch_object()</B ></A >, <A HREF="function.pg-result.html" ><B CLASS="function" >pg_result()</B ></A >. <TABLE WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" CLASS="EXAMPLE" ><TR ><TD ><DIV CLASS="example" ><P ><B >Example 1. Postgres fetch row</B ></P ><TABLE BORDER="0" BGCOLOR="#E0E0E0" WIDTH="100%" ><TR ><TD ><PRE CLASS="programlisting" > 1 2 <?php 3 $conn = pg_pconnect("","","","","publisher"); 4 if (!$conn) { 5 echo "An error occured.\n"; 6 exit; 7 } 8 9 $result = pg_Exec ($conn, "SELECT * FROM authors"); 10 if (!$result) { 11 echo "An error occured.\n"; 12 exit; 13 } 14 15 $row = pg_fetch_row ($result, 0); 16 echo $row[0] . " <- row\n"; 17 18 $row = pg_fetch_row ($result, 1); 19 echo $row[0] . " <- row\n"; 20 21 $row = pg_fetch_row ($result, 2); 22 echo $row[1] . " <- row\n"; 23 ?> 24 </PRE ></TD ></TR ></TABLE ></DIV ></TD ></TR ></TABLE > </P ></DIV ><DIV CLASS="NAVFOOTER" ><HR ALIGN="LEFT" WIDTH="100%"><TABLE WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" ><A HREF="function.pg-fetch-object.html" >Prev</A ></TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="manual.html" >Home</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" ><A HREF="function.pg-fieldisnull.html" >Next</A ></TD ></TR ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" >pg_Fetch_Object</TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="ref.pgsql.html" >Up</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" >pg_FieldIsNull</TD ></TR ></TABLE ></DIV ></BODY ></HTML >