php-doc-en/reference/pdo/functions/PDOStatement-fetchSingle.xml
Dan Scott 0c1bedcdde Document new parameters in PDOStatement::fetch that allow for scrollable
cursors, and add an example of how to use scrollable cursors (finally!).
Add examples for the transaction functions.
Correct a typo in the constants.
Adopt more reference template goodness throughout.


git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@178958 c90b9560-bf6c-de11-be94-00142212c4b1
2005-02-05 18:52:58 +00:00

102 lines
2.6 KiB
XML

<?xml version='1.0' encoding='iso-8859-1'?>
<!-- $Revision: 1.4 $ -->
<!-- Generated by xml_proto.php v2.1. Found in /scripts directory of phpdoc. -->
<refentry id="function.PDOStatement-fetchSingle">
<refnamediv>
<refname>PDOStatement::fetchSingle</refname>
<refpurpose>
Returns the first column in the next row of a result set
</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type>string</type><methodname>PDOStatement::fetchSingle</methodname>
<void/>
</methodsynopsis>
&warn.experimental.func;
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
<function>PDOStatement::fetchSingle</function> returns the first column
in the next row of a result set as a <literal>string</literal> value.
</para>
<warning>
<para>
There is no way to return the second or subsequent columns from a row
if you use this method to retrieve data.
</para>
</warning>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example><title>Return first column of the next row</title>
<programlisting role="php">
<![CDATA[
<?php
$sth = $dbh->prepare("SELECT name, colour FROM fruit");
$sth->execute();
/* Fetch the first column from the next row in the result set */
print("Fetch the first column from the next row in the result set:\n");
$result = $sth->fetchSingle();
print("$result\n");
$result = $sth->fetchSingle();
print("$result\n");
?>
]]>
</programlisting>
&example.outputs;
<screen>
<![CDATA[
Fetch the first column from the next row in the result set:
lemon
orange
]]>
</screen>
</example>
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><function>PDO::query</function></member>
<member><function>PDOStatement::fetch</function></member>
<member><function>PDOStatement::fetchAll</function></member>
<member><function>PDOStatement::prepare</function></member>
<member><function>PDOStatement::setFetchMode</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:"../../../../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
-->