Sophie

Sophie

distrib > Mageia > 4 > x86_64 > by-pkgid > f800694edefe91adea2624f711a41a2d > files > 2536

php-manual-en-5.5.7-1.mga4.noarch.rpm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>Returns the number of rows affected by an SQL statement</title>

 </head>
 <body><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="function.db2-num-fields.html">db2_num_fields</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="function.db2-pclose.html">db2_pclose</a></div>
 <div class="up"><a href="ref.ibm-db2.html">IBM DB2 Functions</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div><hr /><div id="function.db2-num-rows" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">db2_num_rows</h1>
  <p class="verinfo">(PECL ibm_db2 &gt;= 1.0.0)</p><p class="refpurpose"><span class="refname">db2_num_rows</span> &mdash; <span class="dc-title">
   Returns the number of rows affected by an SQL statement
  </span></p>

 </div>
 <div class="refsect1 description" id="refsect1-function.db2-num-rows-description">
  <h3 class="title">Description</h3>
  <div class="methodsynopsis dc-description">
   <span class="type">int</span> <span class="methodname"><strong>db2_num_rows</strong></span>
    ( <span class="methodparam"><span class="type">resource</span> <code class="parameter">$stmt</code></span>
   )</div>



  <p class="para rdfs-comment">
   Returns the number of rows deleted, inserted, or updated by an SQL
   statement.
  </p>
  <p class="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.
  </p>
  <p class="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
    <span class="function"><a href="function.db2-fetch-assoc.html" class="function">db2_fetch_assoc()</a></span>,  <span class="function"><a href="function.db2-fetch-both.html" class="function">db2_fetch_both()</a></span>,
    <span class="function"><a href="function.db2-fetch-array.html" class="function">db2_fetch_array()</a></span>, or  <span class="function"><a href="function.db2-fetch-row.html" class="function">db2_fetch_row()</a></span>,
   and branch if the fetch function returns <strong><code>FALSE</code></strong>.
  </p>

  <blockquote class="note"><p><strong class="note">Note</strong>: 
   <p class="para">
    If you issue a SELECT statement using a scrollable cursor,
     <span class="function"><strong>db2_num_rows()</strong></span> 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 <span class="type"><a href="language.types.boolean.html" class="type boolean">boolean</a></span> return value of the fetch functions to
    achieve the equivalent functionality with much better performance.
   </p>
  </p></blockquote>

 </div>

 <div class="refsect1 parameters" id="refsect1-function.db2-num-rows-parameters">
  <h3 class="title">Parameters</h3>
  <p class="para">
   <dl>

    <dt>

     <span class="term"><em><code class="parameter">stmt</code></em></span>
     <dd>

      <p class="para">
       A valid <em>stmt</em> resource containing a result set.
      </p>
     </dd>

    </dt>

   </dl>

  </p>
 </div>

 <div class="refsect1 returnvalues" id="refsect1-function.db2-num-rows-returnvalues">
  <h3 class="title">Return Values</h3>
  <p class="para">
   Returns the number of rows affected by the last SQL statement issued by
   the specified statement handle.
  </p>
 </div>


 


 


</div><hr /><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="function.db2-num-fields.html">db2_num_fields</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="function.db2-pclose.html">db2_pclose</a></div>
 <div class="up"><a href="ref.ibm-db2.html">IBM DB2 Functions</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div></body></html>