<?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision$ --> <!-- Generated by xml_proto.php v2.2. Found in /scripts directory of phpdoc. --> <refentry xml:id="function.db2-num-rows" xmlns="http://docbook.org/ns/docbook"> <refnamediv> <refname>db2_num_rows</refname> <refpurpose> Returns the number of rows affected by an SQL statement </refpurpose> </refnamediv> <refsect1 role="description"> &reftitle.description; <methodsynopsis> <type>int</type><methodname>db2_num_rows</methodname> <methodparam><type>resource</type><parameter>stmt</parameter></methodparam> </methodsynopsis> <para> Returns the number of rows deleted, inserted, or updated by an SQL statement. </para> <para> To determine the number of rows that will be returned by a SELECT statement, issue SELECT COUNT(*) with the same predicates as your intended SELECT statement and retrieve the value. </para> <para> If your application logic checks the number of rows returned by a SELECT statement and branches if the number of rows is 0, consider modifying your application to attempt to return the first row with one of <function>db2_fetch_assoc</function>, <function>db2_fetch_both</function>, <function>db2_fetch_array</function>, or <function>db2_fetch_row</function>, and branch if the fetch function returns &false;. </para> <note> <para> If you issue a SELECT statement using a scrollable cursor, <function>db2_num_rows</function> returns the number of rows returned by the SELECT statement. However, the overhead associated with scrollable cursors significantly degrades the performance of your application, so if this is the only reason you are considering using scrollable cursors, you should use a forward-only cursor and either call SELECT COUNT(*) or rely on the <type>boolean</type> return value of the fetch functions to achieve the equivalent functionality with much better performance. </para> </note> </refsect1> <refsect1 role="parameters"> &reftitle.parameters; <para> <variablelist> <varlistentry> <term><parameter>stmt</parameter></term> <listitem> <para> A valid <literal>stmt</literal> resource containing a result set. </para> </listitem> </varlistentry> </variablelist> </para> </refsect1> <refsect1 role="returnvalues"> &reftitle.returnvalues; <para> Returns the number of rows affected by the last SQL statement issued by the specified statement handle. </para> </refsect1> <!-- Use when examples exist <refsect1 role="examples"> &reftitle.examples; <para> <example> <title>A <function>db2_num_rows</function> example</title> <para> Any text that describes the purpose of the example, or what goes on in the example should go here (inside the <example> tag, not out </para> <programlisting role="php"> <![CDATA[ <?php if ($anexample === true) { echo 'Use the PEAR Coding Standards'; } ?> ]]> </programlisting> &example.outputs; <screen> <![CDATA[ Use the PEAR Coding Standards ]]> </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:"~/.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 -->