<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/ref.ibm-db2.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'fr',
  ),
  'this' => 
  array (
    0 => 'function.db2-next-result.php',
    1 => 'db2_next_result',
    2 => 'Demande le prochain jeu de r&eacute;sultats de la ressource indiqu&eacute;e',
  ),
  'up' => 
  array (
    0 => 'ref.ibm-db2.php',
    1 => 'Fonctions IBM DB2',
  ),
  'prev' => 
  array (
    0 => 'function.db2-lob-read.php',
    1 => 'db2_lob_read',
  ),
  'next' => 
  array (
    0 => 'function.db2-num-fields.php',
    1 => 'db2_num_fields',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'fr',
    'path' => 'reference/ibm_db2/functions/db2-next-result.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="function.db2-next-result" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">db2_next_result</h1>
  <p class="verinfo">(PECL ibm_db2 &gt;= 1.0.0)</p><p class="refpurpose"><span class="refname">db2_next_result</span> &mdash; <span class="dc-title">
   Demande le prochain jeu de résultats de la ressource indiquée
  </span></p>

 </div>
 <div class="refsect1 description" id="refsect1-function.db2-next-result-description">
  <h3 class="title">Description</h3>
  <div class="methodsynopsis dc-description">
   <span class="methodname"><strong>db2_next_result</strong></span>(<span class="methodparam"><span class="type"><a href="language.types.resource.php" class="type resource">resource</a></span> <code class="parameter">$stmt</code></span>): <span class="type"><span class="type"><a href="language.types.resource.php" class="type resource">resource</a></span>|<span class="type"><a href="language.types.singleton.php" class="type false">false</a></span></span></div>


  <p class="simpara">
   Une procédure d&#039;enregistrement peut retourner aucun ou plusieurs jeux de
   résultats. Il faut gérer le premier jeu de résultats de la même manière
   que l&#039;on gère les résultats retournés par une simple requête SELECT,
   pour obtenir le second ou les résultats suivants, il faut appeler la
   fonction <span class="function"><strong>db2_next_result()</strong></span> et retourner le résultat dans
   une variable PHP.
  </p>

 </div>

 <div class="refsect1 parameters" id="refsect1-function.db2-next-result-parameters">
  <h3 class="title">Liste de paramètres</h3>
  <dl>
   
   <dt><code class="parameter">stmt</code></dt>
    <dd>
     <span class="simpara">
      Une requête préparée retournée par <span class="function"><a href="function.db2-exec.php" class="function">db2_exec()</a></span> ou
      <span class="function"><a href="function.db2-execute.php" class="function">db2_execute()</a></span>.
     </span>
    </dd>
   
  </dl>
 </div>

 <div class="refsect1 returnvalues" id="refsect1-function.db2-next-result-returnvalues">
  <h3 class="title">Valeurs de retour</h3>
  <p class="simpara">
   Retourne une nouvelle ressource contenant le jeu de résultats suivants si
   la procédure contenait un jeu de résultats suivant. Retourne <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong> si la
   procédure n&#039;avait plus de jeu de résultats à retourner.
  </p>
 </div>


 <div class="refsect1 examples" id="refsect1-function.db2-next-result-examples">
  <h3 class="title">Exemples</h3>
  <div class="example" id="example-1">
   <p><strong>Exemple #1 Exemple avec <span class="function"><strong>db2_next_result()</strong></span></strong></p>
   <div class="example-contents"><p>
    Dans l&#039;exemple suivant, nous appelons une procédure qui retourne trois
    jeux de résultats. Le premier jeu de résultats est récupéré directement
    de la même ressource sur laquelle on a invoqué une requête CALL, alors
    que le deuxième et troisième jeux de résultats sont récupérés des
    ressources retournées par l&#039;appel de la fonction
    <span class="function"><strong>db2_next_result()</strong></span>.
   </p></div>
   <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br />$conn </span><span style="color: #007700">= </span><span style="color: #0000BB">db2_connect</span><span style="color: #007700">(</span><span style="color: #0000BB">$database</span><span style="color: #007700">, </span><span style="color: #0000BB">$user</span><span style="color: #007700">, </span><span style="color: #0000BB">$password</span><span style="color: #007700">);<br /><br />if (</span><span style="color: #0000BB">$conn</span><span style="color: #007700">) {<br />  </span><span style="color: #0000BB">$stmt </span><span style="color: #007700">= </span><span style="color: #0000BB">db2_exec</span><span style="color: #007700">(</span><span style="color: #0000BB">$conn</span><span style="color: #007700">, </span><span style="color: #DD0000">'CALL multiResults()'</span><span style="color: #007700">);<br /><br />  print </span><span style="color: #DD0000">"Récupération du premier jeu de résultats\n"</span><span style="color: #007700">;<br />  while (</span><span style="color: #0000BB">$row </span><span style="color: #007700">= </span><span style="color: #0000BB">db2_fetch_array</span><span style="color: #007700">(</span><span style="color: #0000BB">$stmt</span><span style="color: #007700">)) {<br />    </span><span style="color: #0000BB">var_dump</span><span style="color: #007700">(</span><span style="color: #0000BB">$row</span><span style="color: #007700">);<br />  }<br /><br />  print </span><span style="color: #DD0000">"\nRécupération du deuxième jeu de résultats\n"</span><span style="color: #007700">;<br />  </span><span style="color: #0000BB">$res </span><span style="color: #007700">= </span><span style="color: #0000BB">db2_next_result</span><span style="color: #007700">(</span><span style="color: #0000BB">$stmt</span><span style="color: #007700">);<br />  if (</span><span style="color: #0000BB">$res</span><span style="color: #007700">) {<br />    while (</span><span style="color: #0000BB">$row </span><span style="color: #007700">= </span><span style="color: #0000BB">db2_fetch_array</span><span style="color: #007700">(</span><span style="color: #0000BB">$res</span><span style="color: #007700">)) {<br />      </span><span style="color: #0000BB">var_dump</span><span style="color: #007700">(</span><span style="color: #0000BB">$row</span><span style="color: #007700">);<br />    }<br />  }<br /><br />  print </span><span style="color: #DD0000">"\nRécupération du troisième jeu de résultats\n"</span><span style="color: #007700">;<br />  </span><span style="color: #0000BB">$res2 </span><span style="color: #007700">= </span><span style="color: #0000BB">db2_next_result</span><span style="color: #007700">(</span><span style="color: #0000BB">$stmt</span><span style="color: #007700">);<br />  if (</span><span style="color: #0000BB">$res2</span><span style="color: #007700">) {<br />    while (</span><span style="color: #0000BB">$row </span><span style="color: #007700">= </span><span style="color: #0000BB">db2_fetch_array</span><span style="color: #007700">(</span><span style="color: #0000BB">$res2</span><span style="color: #007700">)) {<br />      </span><span style="color: #0000BB">var_dump</span><span style="color: #007700">(</span><span style="color: #0000BB">$row</span><span style="color: #007700">);<br />    }<br />  }<br /><br />  </span><span style="color: #0000BB">db2_close</span><span style="color: #007700">(</span><span style="color: #0000BB">$conn</span><span style="color: #007700">);<br />}<br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>
   </div>

   <div class="example-contents"><p>L&#039;exemple ci-dessus va afficher :</p></div>
   <div class="example-contents screen">
<div class="examplescode"><pre class="examplescode">Récupération du premier jeu de résultats
array(2) {
  [0]=&gt;
  string(16) &quot;Bubbles         &quot;
  [1]=&gt;
  int(3)
}
array(2) {
  [0]=&gt;
  string(16) &quot;Gizmo           &quot;
  [1]=&gt;
  int(4)
}

Récupération du deuxième jeu de résultats
array(4) {
  [0]=&gt;
  string(16) &quot;Sweater         &quot;
  [1]=&gt;
  int(6)
  [2]=&gt;
  string(5) &quot;lama&quot;
  [3]=&gt;
  string(6) &quot;150.00&quot;
}
array(4) {
  [0]=&gt;
  string(16) &quot;Smarty          &quot;
  [1]=&gt;
  int(2)
  [2]=&gt;
  string(5) &quot;cheval&quot;
  [3]=&gt;
  string(6) &quot;350.00&quot;
}

Récupération du troisième jeu de résultats
array(1) {
  [0]=&gt;
  string(16) &quot;Bubbles         &quot;
}
array(1) {
  [0]=&gt;
  string(16) &quot;Gizmo           &quot;
}</pre>
</div>
   </div>
  </div>
 </div>


 


</div><?php manual_footer($setup); ?>