cvs: phpdoc /en/reference/pgsql/functions pg-fetch-array.xml pg-fetch-assoc.xml pg-fetch-object.xml

From: Date: Sun, 09 Jan 2005 17:15:11 +0000
Subject: cvs: phpdoc /en/reference/pgsql/functions pg-fetch-array.xml pg-fetch-assoc.xml pg-fetch-object.xml
Groups: php.doc 
Request: Send a blank email to phpdoc+get-969365884@lists.php.net to get a copy of this message
irchtml Sun Jan 9 12:15:11 2005 EDT Modified files: /phpdoc/en/reference/pgsql/functions pg-fetch-array.xml pg-fetch-assoc.xml pg-fetch-object.xml Log: Minor example changes; incorporating user notes http://cvs.php.net/diff.php/phpdoc/en/reference/pgsql/functions/pg-fetch-array.xml?r1=1.9&r2=1.10&ty=u Index: phpdoc/en/reference/pgsql/functions/pg-fetch-array.xml diff -u phpdoc/en/reference/pgsql/functions/pg-fetch-array.xml:1.9 phpdoc/en/reference/pgsql/functions/pg-fetch-array.xml:1.10 --- phpdoc/en/reference/pgsql/functions/pg-fetch-array.xml:1.9 Mon Jul 26 10:02:10 2004 +++ phpdoc/en/reference/pgsql/functions/pg-fetch-array.xml Sun Jan 9 12:15:09 2005 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.9 $ --> +<!-- $Revision: 1.10 $ --> <!-- splitted from ./en/functions/pgsql.xml, last change in rev 1.2 --> <refentry id="function.pg-fetch-array"> <refnamediv> @@ -37,10 +37,11 @@ <parameter>result_type</parameter> is a constant and can take the following values: <constant>PGSQL_ASSOC</constant>, <constant>PGSQL_NUM</constant>, and <constant>PGSQL_BOTH</constant>. - <function>pg_fetch_array</function> returns associative array - that has field name as key for <constant>PGSQL_ASSOC</constant>, field index as key - with <constant>PGSQL_NUM</constant> and both field name/index as key with - <constant>PGSQL_BOTH</constant>. Default is <constant>PGSQL_BOTH</constant>. + Using <constant>PGSQL_NUM</constant>, <function>pg_fetch_array</function> + will return an array with numerical indices, using + <constant>PGSQL_ASSOC</constant> will return only associative indices + while <constant>PGSQL_BOTH</constant>, the default, will return both + numerical and associative indices. <note> <para> <parameter>result_type</parameter> was added in PHP 4.0. @@ -65,17 +66,26 @@ 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; } $arr = pg_fetch_array($result, 0, PGSQL_NUM); -echo $arr[0] . " <- array\n"; +echo $arr[0] . " <- Row 1 Author\n"; +echo $arr[1] . " <- Row 1 E-mail\n"; -$arr = pg_fetch_array($result, 1, PGSQL_ASSOC); -echo $arr["author"] . " <- array\n"; +// As of PHP 4.1.0, the row parameter is optional; NULL can be passed instead, +// to pass a result_type. Successive calls to pg_fetch_array will return the +// next row. +$arr = pg_fetch_array($result, NULL, PGSQL_ASSOC); +echo $arr["author"] . " <- Row 2 Author\n"; +echo $arr["email"] . " <- Row 2 E-mail\n"; + +$arr = pg_fetch_array($result); +echo $arr["author"] . " <- Row 3 Author\n"; +echo $arr[1] . " <- Row 3 E-mail\n"; ?> ]]> @@ -86,7 +96,7 @@ <para> From 4.1.0, <parameter>row</parameter> became optional. Calling <function>pg_fetch_array</function> will increment - internal row counter by 1. + the internal row counter by one. </para> </note> <para> http://cvs.php.net/diff.php/phpdoc/en/reference/pgsql/functions/pg-fetch-assoc.xml?r1=1.7&r2=1.8&ty=u Index: phpdoc/en/reference/pgsql/functions/pg-fetch-assoc.xml diff -u phpdoc/en/reference/pgsql/functions/pg-fetch-assoc.xml:1.7 phpdoc/en/reference/pgsql/functions/pg-fetch-assoc.xml:1.8 --- phpdoc/en/reference/pgsql/functions/pg-fetch-assoc.xml:1.7 Mon Jul 26 10:02:10 2004 +++ phpdoc/en/reference/pgsql/functions/pg-fetch-assoc.xml Sun Jan 9 12:15:09 2005 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.7 $ --> +<!-- $Revision: 1.8 $ --> <!-- splitted from ./en/functions/pgsql.xml, last change in rev 1.2 --> <refentry id="function.pg-fetch-assoc"> <refnamediv> @@ -63,6 +63,13 @@ </programlisting> </example> </para> + <note> + <para> + From 4.1.0, <parameter>row</parameter> became optional. + Calling <function>pg_fetch_assoc</function> will increment + the internal row counter by one. + </para> + </note> <para> See also <function>pg_fetch_row</function>, http://cvs.php.net/diff.php/phpdoc/en/reference/pgsql/functions/pg-fetch-object.xml?r1=1.12&r2=1.13&ty=u Index: phpdoc/en/reference/pgsql/functions/pg-fetch-object.xml diff -u phpdoc/en/reference/pgsql/functions/pg-fetch-object.xml:1.12 phpdoc/en/reference/pgsql/functions/pg-fetch-object.xml:1.13 --- phpdoc/en/reference/pgsql/functions/pg-fetch-object.xml:1.12 Mon Jul 26 10:02:10 2004 +++ phpdoc/en/reference/pgsql/functions/pg-fetch-object.xml Sun Jan 9 12:15:09 2005 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.12 $ --> +<!-- $Revision: 1.13 $ --> <!-- splitted from ./en/functions/pgsql.xml, last change in rev 1.2 --> <refentry id="function.pg-fetch-object"> <refnamediv> @@ -39,9 +39,6 @@ </para> <note> <para> - From 4.1.0, <parameter>row</parameter> is optional. - </para> - <para> From 4.3.0, <parameter>result_type</parameter> is default to PGSQL_ASSOC while older versions' default was PGSQL_BOTH. There is no use for numeric property, since numeric property name is invalid in PHP. @@ -88,7 +85,7 @@ <para> From 4.1.0, <parameter>row</parameter> became optional. Calling <function>pg_fetch_object</function> will increment - internal row counter counter by 1. + the internal row counter counter by one. </para> </note> <para>

« previous php.doc (#969365884) next »