php-doc-en/reference/pgsql/functions/pg-fetch-assoc.xml
Dallas Wang a6cbbdb5a6 Remove additional See also part
git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@118394 c90b9560-bf6c-de11-be94-00142212c4b1
2003-02-28 06:33:49 +00:00

91 lines
2.6 KiB
XML

<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.4 $ -->
<!-- splitted from ./en/functions/pgsql.xml, last change in rev 1.2 -->
<refentry id="function.pg-fetch-assoc">
<refnamediv>
<refname>pg_fetch_assoc</refname>
<refpurpose>Fetch a row as an array</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>array</type><methodname>pg_fetch_assoc</methodname>
<methodparam><type>resource</type><parameter>result</parameter></methodparam>
<methodparam choice="opt"><type>int</type><parameter>row</parameter></methodparam>
</methodsynopsis>
<para>
<function>pg_fetch_assoc</function> returns an associative array that
corresponds to the fetched row (tuples/records). It returns
&false;, if there are no more rows.
</para>
<para>
<function>pg_fetch_assoc</function> is an extended version of
<function>pg_fetch_row</function>. In addition to storing the
data in the numeric indices (field index) to the result array, it
also stores the data in associative indices (field name) by
default.
</para>
<para>
<parameter>row</parameter> is row (record) number to be
retrieved. First row is 0.
</para>
<para>
<function>pg_fetch_assoc</function> is NOT significantly
slower than using <function>pg_fetch_row</function>, while it
provides a significant ease of use.
</para>
<para>
<example>
<title>PostgreSQL fetch array</title>
<programlisting role="php">
<![CDATA[
<?php
$conn = pg_pconnect ("dbname=publisher");
if (!$conn) {
echo "An error occured.\n";
exit;
}
$result = pg_query ($conn, "SELECT * FROM authors");
if (!$result) {
echo "An error occured.\n";
exit;
}
$arr = pg_fetch_assoc ($result, 1, PGSQL_ASSOC);
echo $arr["author"] . " <- array\n";
?>
]]>
</programlisting>
</example>
</para>
<para>
See also
<function>pg_fetch_row</function>,
<function>pg_fetch_array</function>,
<function>pg_fetch_object</function>, and
<function>pg_fetch_result</function>.
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"../../../../manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->