2005-01-18 03:16:39 +00:00
|
|
|
<?xml version="1.0" encoding="iso-8859-1"?>
|
2005-01-26 05:35:40 +00:00
|
|
|
<!-- $Revision: 1.2 $ -->
|
2005-01-18 03:16:39 +00:00
|
|
|
<!-- Generated by xml_proto.php v2.2. Found in /scripts directory of phpdoc. -->
|
|
|
|
<refentry id="function.PDOStatement-setFetchMode">
|
|
|
|
<refnamediv>
|
|
|
|
<refname>PDOStatement::setFetchMode</refname>
|
|
|
|
<refpurpose>
|
2005-01-26 05:35:40 +00:00
|
|
|
Set the default fetch mode for this statement
|
2005-01-18 03:16:39 +00:00
|
|
|
</refpurpose>
|
|
|
|
</refnamediv>
|
|
|
|
<refsect1 role="description">
|
|
|
|
&reftitle.description;
|
|
|
|
<methodsynopsis>
|
|
|
|
<type>bool</type><methodname>PDOStatement::setFetchMode</methodname>
|
|
|
|
<methodparam><type>int</type><parameter>mode</parameter></methodparam>
|
|
|
|
</methodsynopsis>
|
|
|
|
|
2005-01-26 05:35:40 +00:00
|
|
|
&warn.experimental.func;
|
2005-01-18 03:16:39 +00:00
|
|
|
|
|
|
|
</refsect1>
|
|
|
|
<refsect1 role="parameters">
|
|
|
|
&reftitle.parameters;
|
|
|
|
<para>
|
|
|
|
<variablelist>
|
|
|
|
<varlistentry>
|
|
|
|
<term><parameter>mode</parameter></term>
|
|
|
|
<listitem>
|
|
|
|
<para>
|
2005-01-26 05:35:40 +00:00
|
|
|
The fetch mode must be one of the <literal>PDO_FETCH_*</literal> constants.
|
2005-01-18 03:16:39 +00:00
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
</variablelist>
|
|
|
|
</para>
|
|
|
|
</refsect1>
|
2005-01-26 05:35:40 +00:00
|
|
|
|
2005-01-18 03:16:39 +00:00
|
|
|
<refsect1 role="returnvalues">
|
|
|
|
&reftitle.returnvalues;
|
|
|
|
<para>
|
2005-01-26 05:35:40 +00:00
|
|
|
Returns <literal>1</literal> on success or &false; on failure.
|
2005-01-18 03:16:39 +00:00
|
|
|
</para>
|
|
|
|
</refsect1>
|
|
|
|
|
|
|
|
<refsect1 role="examples">
|
|
|
|
&reftitle.examples;
|
|
|
|
<para>
|
|
|
|
<example>
|
2005-01-26 05:35:40 +00:00
|
|
|
<title>Setting the fetch mode</title>
|
2005-01-18 03:16:39 +00:00
|
|
|
<para>
|
2005-01-26 05:35:40 +00:00
|
|
|
The following example demonstrates how
|
|
|
|
<function>PDOStatement::setFetchMode</function> changes the default fetch
|
|
|
|
mode for a PDOStatement object.
|
2005-01-18 03:16:39 +00:00
|
|
|
</para>
|
|
|
|
<programlisting role="php">
|
|
|
|
<![CDATA[
|
|
|
|
<?php
|
2005-01-26 05:35:40 +00:00
|
|
|
$sql = 'SELECT name, colour, calories FROM fruit';
|
|
|
|
try {
|
|
|
|
$stmt = $dbh->query($sql);
|
|
|
|
$result = $stmt->setFetchMode(PDO_FETCH_NUM);
|
|
|
|
while ($row = $stmt->fetch()) {
|
|
|
|
print $row[0] . "\t" . $row[1] . "\t" . $row[2] . "\n";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
catch (PDOException $e) {
|
|
|
|
print $e->getMessage();
|
2005-01-18 03:16:39 +00:00
|
|
|
}
|
|
|
|
?>
|
|
|
|
]]>
|
|
|
|
</programlisting>
|
|
|
|
&example.outputs;
|
|
|
|
<screen>
|
|
|
|
<![CDATA[
|
2005-01-26 05:35:40 +00:00
|
|
|
apple red 150
|
|
|
|
banana yellow 250
|
|
|
|
orange orange 300
|
|
|
|
kiwi brown 75
|
|
|
|
lemon yellow 25
|
|
|
|
pear green 150
|
|
|
|
watermelon pink 90
|
2005-01-18 03:16:39 +00:00
|
|
|
]]>
|
|
|
|
</screen>
|
|
|
|
</example>
|
|
|
|
</para>
|
|
|
|
</refsect1>
|
|
|
|
|
|
|
|
<!-- Use when adding See Also links
|
|
|
|
<refsect1 role="seealso">
|
|
|
|
&reftitle.seealso;
|
|
|
|
<para>
|
|
|
|
<simplelist>
|
|
|
|
<member><function></function></member>
|
|
|
|
<member>Or <link linkend="somethingelse">something else</link></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:"../../../../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
|
|
|
|
-->
|