2002-10-02 05:58:55 +00:00
|
|
|
<?xml version="1.0" encoding="iso-8859-1"?>
|
2004-07-26 14:02:10 +00:00
|
|
|
<!-- $Revision: 1.5 $ -->
|
2002-10-02 05:58:55 +00:00
|
|
|
<!-- splitted from ./en/functions/pgsql.xml, last change in rev 1.2 -->
|
|
|
|
<refentry id="function.pg-fetch-all">
|
|
|
|
<refnamediv>
|
|
|
|
<refname>pg_fetch_all</refname>
|
2003-07-16 15:05:34 +00:00
|
|
|
<refpurpose>Fetches all rows from a result as an array</refpurpose>
|
2002-10-02 05:58:55 +00:00
|
|
|
</refnamediv>
|
|
|
|
<refsect1>
|
|
|
|
<title>Description</title>
|
|
|
|
<methodsynopsis>
|
|
|
|
<type>array</type><methodname>pg_fetch_all</methodname>
|
|
|
|
<methodparam><type>resource</type><parameter>result</parameter></methodparam>
|
|
|
|
</methodsynopsis>
|
|
|
|
<para>
|
|
|
|
<function>pg_fetch_all</function> returns an array that
|
2003-06-29 23:26:02 +00:00
|
|
|
contains all rows (tuples/records) in result resource. It returns
|
|
|
|
&false;, if there are no rows.
|
2002-10-02 05:58:55 +00:00
|
|
|
</para>
|
2004-07-26 14:02:10 +00:00
|
|
|
&database.fetch-null;
|
2002-10-02 05:58:55 +00:00
|
|
|
<para>
|
|
|
|
<example>
|
2003-06-29 23:26:02 +00:00
|
|
|
<title>PostgreSQL fetch all</title>
|
2002-10-02 05:58:55 +00:00
|
|
|
<programlisting role="php">
|
|
|
|
<![CDATA[
|
|
|
|
<?php
|
2003-07-16 09:20:01 +00:00
|
|
|
$conn = pg_pconnect("dbname=publisher");
|
2002-10-02 05:58:55 +00:00
|
|
|
if (!$conn) {
|
|
|
|
echo "An error occured.\n";
|
|
|
|
exit;
|
|
|
|
}
|
|
|
|
|
2003-07-16 09:20:01 +00:00
|
|
|
$result = pg_query($conn, "SELECT * FROM authors");
|
2002-10-02 05:58:55 +00:00
|
|
|
if (!$result) {
|
|
|
|
echo "An error occured.\n";
|
|
|
|
exit;
|
|
|
|
}
|
|
|
|
|
2003-07-16 09:20:01 +00:00
|
|
|
$arr = pg_fetch_all($result);
|
2002-10-02 05:58:55 +00:00
|
|
|
|
|
|
|
var_dump($arr);
|
|
|
|
|
|
|
|
?>
|
|
|
|
]]>
|
|
|
|
</programlisting>
|
|
|
|
</example>
|
|
|
|
</para>
|
2003-07-16 09:20:01 +00:00
|
|
|
<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>
|
2002-10-02 05:58:55 +00:00
|
|
|
</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
|
|
|
|
-->
|