mirror of
https://github.com/php/doc-it.git
synced 2026-04-28 17:53:23 +02:00
154 lines
4.3 KiB
XML
154 lines
4.3 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
|
<!-- EN-Revision: c2eca73ef79ebe78cebb34053e41b565af504c4f Maintainer: pastore Status: ready -->
|
|
<!-- splitted from ./en/functions/pgsql.xml, last change in rev 1.2 -->
|
|
<refentry xml:id="function.pg-fetch-assoc" xmlns="http://docbook.org/ns/docbook">
|
|
<refnamediv>
|
|
<refname>pg_fetch_assoc</refname>
|
|
<refpurpose>Recupera una riga come array associativo</refpurpose>
|
|
</refnamediv>
|
|
|
|
<refsect1 role="description">
|
|
&reftitle.description;
|
|
<methodsynopsis>
|
|
<type class="union"><type>array</type><type>false</type></type><methodname>pg_fetch_assoc</methodname>
|
|
<methodparam><type>PgSql\Result</type><parameter>result</parameter></methodparam>
|
|
<methodparam choice="opt"><type class="union"><type>int</type><type>null</type></type><parameter>row</parameter><initializer>&null;</initializer></methodparam>
|
|
</methodsynopsis>
|
|
<para>
|
|
<function>pg_fetch_assoc</function> restituisce un array associativo che
|
|
corrisponde alla riga (record) recuperata.
|
|
</para>
|
|
<para>
|
|
<function>pg_fetch_assoc</function> è equivalente a chiamare
|
|
<function>pg_fetch_array</function> con <constant>PGSQL_ASSOC</constant> come
|
|
terzo parametro opzionale. Restituisce solo un array associativo.
|
|
Se si ha bisogno degli indici numerici, utilizzare
|
|
<function>pg_fetch_row</function>.
|
|
</para>
|
|
&database.fetch-null;
|
|
<para>
|
|
<function>pg_fetch_assoc</function> NON è significativamente
|
|
più lenta di <function>pg_fetch_row</function> ed
|
|
è significativamente più facile da usare.
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="parameters">
|
|
&reftitle.parameters;
|
|
<para>
|
|
<variablelist>
|
|
<varlistentry>
|
|
<term><parameter>result</parameter></term>
|
|
<listitem>
|
|
&pgsql.parameter.result;
|
|
</listitem>
|
|
</varlistentry>
|
|
<varlistentry>
|
|
<term><parameter>row</parameter></term>
|
|
<listitem>
|
|
<para>
|
|
Numero di riga nel risultato da recuperare. Le righe sono numerate da 0 in su. Se
|
|
viene omesso o &null;, viene recuperata la riga successiva.
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
</variablelist>
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="returnvalues">
|
|
&reftitle.returnvalues;
|
|
<para>
|
|
Un <type>array</type> indicizzato in modo associativo (per nome di campo).
|
|
Ogni valore nell'<type>array</type> è rappresentato come
|
|
<type>string</type>. I valori <literal>NULL</literal>
|
|
del database vengono restituiti come &null;.
|
|
</para>
|
|
<para>
|
|
&false; viene restituito se <parameter>row</parameter> supera il numero
|
|
di righe nel set, non ci sono più righe o per qualsiasi altro errore.
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="changelog">
|
|
&reftitle.changelog;
|
|
<informaltable>
|
|
<tgroup cols="2">
|
|
<thead>
|
|
<row>
|
|
<entry>&Version;</entry>
|
|
<entry>&Description;</entry>
|
|
</row>
|
|
</thead>
|
|
<tbody>
|
|
&pgsql.changelog.result-object;
|
|
</tbody>
|
|
</tgroup>
|
|
</informaltable>
|
|
</refsect1>
|
|
|
|
<refsect1 role="examples">
|
|
&reftitle.examples;
|
|
<para>
|
|
<example>
|
|
<title>Esempio di <function>pg_fetch_assoc</function></title>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
$conn = pg_connect("dbname=publisher");
|
|
if (!$conn) {
|
|
echo "Si è verificato un errore.\n";
|
|
exit;
|
|
}
|
|
|
|
$result = pg_query($conn, "SELECT id, author, email FROM authors");
|
|
if (!$result) {
|
|
echo "Si è verificato un errore.\n";
|
|
exit;
|
|
}
|
|
|
|
while ($row = pg_fetch_assoc($result)) {
|
|
echo $row['id'];
|
|
echo $row['author'];
|
|
echo $row['email'];
|
|
}
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
</example>
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="seealso">
|
|
&reftitle.seealso;
|
|
<para>
|
|
<simplelist>
|
|
<member><function>pg_fetch_row</function></member>
|
|
<member><function>pg_fetch_array</function></member>
|
|
<member><function>pg_fetch_object</function></member>
|
|
<member><function>pg_fetch_result</function></member>
|
|
</simplelist>
|
|
</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:"~/.phpdoc/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
|
|
-->
|