php-doc-en/reference/pgsql/functions/pg-fetch-row.xml
2003-02-21 23:17:32 +00:00

95 lines
2.4 KiB
XML

<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.6 $ -->
<!-- splitted from ./en/functions/pgsql.xml, last change in rev 1.2 -->
<refentry id="function.pg-fetch-row">
<refnamediv>
<refname>pg_fetch_row</refname>
<refpurpose>Get a row as an enumerated array</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<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>
</methodsynopsis>
<para>
<function>pg_fetch_row</function> fetches one row of data from
the result associated with the specified
<parameter>result</parameter> resource. The row (record) is
returned as an array. Each result column is stored in an array
offset, starting at offset 0.
</para>
<para>
It returns an array that corresponds to the fetched row, or &false;
if there are no more rows.
</para>
<para>
<example>
<title>Postgres fetch row</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;
}
while ($row = pg_fetch_row($result, $i)) {
for ($j=0; $j < count($row); $j++) {
echo "$row[$j]&nbsp;";
}
echo "<BR>";
}
?>
]]>
</programlisting>
</example>
</para>
<para>
See also
<function>pg_query</function>,
<function>pg_fetch_array</function>,
<function>pg_fetch_object</function>, and
<function>pg_fetch_result</function>.
</para>
<note>
<para>
From 4.1.0, <parameter>row</parameter> became optional.
Calling <function>pg_fetch_row</function> will increment
internal row counter by 1.
</para>
</note>
</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
-->