<?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-result.php',
    1 => 'db2_result',
    2 => 'Retourne une colonne d\'une ligne d\'un jeu de r&eacute;sultats',
  ),
  'up' => 
  array (
    0 => 'ref.ibm-db2.php',
    1 => 'Fonctions IBM DB2',
  ),
  'prev' => 
  array (
    0 => 'function.db2-procedures.php',
    1 => 'db2_procedures',
  ),
  'next' => 
  array (
    0 => 'function.db2-rollback.php',
    1 => 'db2_rollback',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'fr',
    'path' => 'reference/ibm_db2/functions/db2-result.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="function.db2-result" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">db2_result</h1>
  <p class="verinfo">(PECL ibm_db2 &gt;= 1.0.0)</p><p class="refpurpose"><span class="refname">db2_result</span> &mdash; <span class="dc-title">
   Retourne une colonne d&#039;une ligne d&#039;un jeu de résultats
  </span></p>

 </div>
 <div class="refsect1 description" id="refsect1-function.db2-result-description">
  <h3 class="title">Description</h3>
  <div class="methodsynopsis dc-description">
   <span class="methodname"><strong>db2_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="methodparam"><span class="type"><span class="type"><a href="language.types.integer.php" class="type int">int</a></span>|<span class="type"><a href="language.types.string.php" class="type string">string</a></span></span> <code class="parameter">$column</code></span>): <span class="type"><span class="type"><a href="language.types.null.php" class="type null">?</a></span><span class="type"><a href="language.types.mixed.php" class="type mixed">mixed</a></span></span></div>


  <p class="simpara">
   Utiliser <span class="function"><strong>db2_result()</strong></span> pour retourner une valeur d&#039;une
   colonne spécifique dans la ligne courante d&#039;un jeu de résultats. Il faut
   appeler <span class="function"><a href="function.db2-fetch-row.php" class="function">db2_fetch_row()</a></span> avant d&#039;appeler
   <span class="function"><strong>db2_result()</strong></span> pour enregistrer les valeurs pointées du
   jeu de résultats.
  </p>

 </div>

 <div class="refsect1 parameters" id="refsect1-function.db2-result-parameters">
  <h3 class="title">Liste de paramètres</h3>
  <dl>
   
    <dt><code class="parameter">stmt</code></dt>
     <dd>
      <span class="simpara">
       Une ressource <code class="literal">stmt</code> valide.
      </span>
     </dd>
    
   
    <dt><code class="parameter">column</code></dt>
     <dd>
      <span class="simpara">
       Un tableau d&#039;entier commençant avec l&#039;indice 0 qui pointe vers les
       champs du jeu de résultats ou une chaîne représentant le nom de la
       colonne.
      </span>
     </dd>
    
  </dl>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.db2-result-returnvalues">
  <h3 class="title">Valeurs de retour</h3>
  <p class="simpara">
   Retourne la valeur du champ demandé si le champ existe dans le jeu de
   résultats. Retourne <strong><code><a href="reserved.constants.php#constant.null">null</a></code></strong> si le champ n&#039;existe pas et retourne une
   alerte PHP.
  </p>
 </div>


 <div class="refsect1 examples" id="refsect1-function.db2-result-examples">
  <h3 class="title">Exemples</h3>
  <div class="example" id="example-1">
   <p><strong>Exemple #1 Exemple d&#039;utilisation de <span class="function"><strong>db2_result()</strong></span></strong></p>
   <div class="example-contents"><p>
    L&#039;exemple suivant démontre comment itérer à travers un jeu de résultats
    avec la fonction <span class="function"><a href="function.db2-fetch-row.php" class="function">db2_fetch_row()</a></span> et récupérer les
    colonnes du jeu de résultats avec <span class="function"><strong>db2_result()</strong></span>.
   </p></div>
   <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br />$sql </span><span style="color: #007700">= </span><span style="color: #DD0000">'SELECT nom, race FROM animaux WHERE poids &lt; ?'</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">$stmt </span><span style="color: #007700">= </span><span style="color: #0000BB">db2_prepare</span><span style="color: #007700">(</span><span style="color: #0000BB">$conn</span><span style="color: #007700">, </span><span style="color: #0000BB">$sql</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">db2_execute</span><span style="color: #007700">(</span><span style="color: #0000BB">$stmt</span><span style="color: #007700">, array(</span><span style="color: #0000BB">10</span><span style="color: #007700">));<br />while (</span><span style="color: #0000BB">db2_fetch_row</span><span style="color: #007700">(</span><span style="color: #0000BB">$stmt</span><span style="color: #007700">)) {<br />    </span><span style="color: #0000BB">$nom </span><span style="color: #007700">= </span><span style="color: #0000BB">db2_result</span><span style="color: #007700">(</span><span style="color: #0000BB">$stmt</span><span style="color: #007700">, </span><span style="color: #0000BB">0</span><span style="color: #007700">);<br />    </span><span style="color: #0000BB">$race </span><span style="color: #007700">= </span><span style="color: #0000BB">db2_result</span><span style="color: #007700">(</span><span style="color: #0000BB">$stmt</span><span style="color: #007700">, </span><span style="color: #DD0000">'RACE'</span><span style="color: #007700">);<br />    print </span><span style="color: #DD0000">"</span><span style="color: #0000BB">$nom</span><span style="color: #DD0000"> </span><span style="color: #0000BB">$race</span><span style="color: #DD0000">"</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">chat Pook
cyprin doré Bubbles
perruche Gizmo
chèvre Rickety Ride</pre>
</div>
   </div>
  </div>
 </div>


 <div class="refsect1 seealso" id="refsect1-function.db2-result-seealso">
  <h3 class="title">Voir aussi</h3>
  <ul class="simplelist">
   <li><span class="function"><a href="function.db2-fetch-array.php" class="function" rel="rdfs-seeAlso">db2_fetch_array()</a> - Retourne un tableau, index&eacute; par la position des colonnes, repr&eacute;sentant une
   ligne du jeu de r&eacute;sultats</span></li>
   <li><span class="function"><a href="function.db2-fetch-assoc.php" class="function" rel="rdfs-seeAlso">db2_fetch_assoc()</a> - Retourne un tableau, index&eacute; par nom de colonne, repr&eacute;sentant une ligne du jeu
   de r&eacute;sultats</span></li>
   <li><span class="function"><a href="function.db2-fetch-both.php" class="function" rel="rdfs-seeAlso">db2_fetch_both()</a> - Retourne un tableau, index&eacute; par nom de colonne et position, repr&eacute;sentant
   une ligne du jeu de r&eacute;sultats</span></li>
   <li><span class="function"><a href="function.db2-fetch-object.php" class="function" rel="rdfs-seeAlso">db2_fetch_object()</a> - Retourne un objet avec les propri&eacute;t&eacute;s repr&eacute;sentant des colonnes dans la
   ligne extraite</span></li>
   <li><span class="function"><a href="function.db2-fetch-row.php" class="function" rel="rdfs-seeAlso">db2_fetch_row()</a> - Modifie le pointeur du jeu de r&eacute;sultat &agrave; la prochaine ligne ou &agrave; la ligne
   demand&eacute;e</span></li>
  </ul>
 </div>

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