cvs: phpdoc /en/reference/pgsql/functions pg-fetch-row.xml

From: Date: Sun, 09 Jan 2005 16:43:26 +0000
Subject: cvs: phpdoc /en/reference/pgsql/functions pg-fetch-row.xml
Groups: php.doc 
Request: Send a blank email to phpdoc+get-969365883@lists.php.net to get a copy of this message
irchtml Sun Jan 9 11:43:26 2005 EDT Modified files: /phpdoc/en/reference/pgsql/functions pg-fetch-row.xml Log: Fix proto, update example incorporating notes http://cvs.php.net/diff.php/phpdoc/en/reference/pgsql/functions/pg-fetch-row.xml?r1=1.8&r2=1.9&ty=u Index: phpdoc/en/reference/pgsql/functions/pg-fetch-row.xml diff -u phpdoc/en/reference/pgsql/functions/pg-fetch-row.xml:1.8 phpdoc/en/reference/pgsql/functions/pg-fetch-row.xml:1.9 --- phpdoc/en/reference/pgsql/functions/pg-fetch-row.xml:1.8 Mon Jul 26 10:02:10 2004 +++ phpdoc/en/reference/pgsql/functions/pg-fetch-row.xml Sun Jan 9 11:43:25 2005 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.8 $ --> +<!-- $Revision: 1.9 $ --> <!-- splitted from ./en/functions/pgsql.xml, last change in rev 1.2 --> <refentry id="function.pg-fetch-row"> <refnamediv> @@ -11,7 +11,7 @@ <methodsynopsis> <type>array</type><methodname>pg_fetch_row</methodname> <methodparam><type>resource</type><parameter>result</parameter></methodparam> - <methodparam><type>int</type><parameter>row</parameter></methodparam> + <methodparam choice="opt"><type>int</type><parameter>row</parameter></methodparam> </methodsynopsis> <para> <function>pg_fetch_row</function> fetches one row of data from @@ -30,26 +30,23 @@ <title><function>pg_fetch_row</function> example</title> <programlisting role="php"> <![CDATA[ -<?php +<?php + $conn = pg_pconnect("dbname=publisher"); if (!$conn) { echo "An error occured.\n"; exit; } -$result = pg_query($conn, "SELECT * FROM authors"); +$result = pg_query($conn, "SELECT author, email FROM authors"); if (!$result) { echo "An error occured.\n"; exit; } -while ($row = pg_fetch_row($result, $i)) { - for ($j=0; $j < count($row); $j++) { - echo $row[$j] . "&nbsp;"; - } - - echo "<br />\n"; - +while ($row = pg_fetch_row($result)) { + echo "Author: $row[0] E-mail: $row[1]"; + echo "<br />\n"; } ?> @@ -61,7 +58,7 @@ <para> From 4.1.0, <parameter>row</parameter> became optional. Calling <function>pg_fetch_row</function> will increment - internal row counter by 1. + the internal row counter by one. </para> </note> <para>

« previous php.doc (#969365883) next »