Sophie

Sophie

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

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>Get row as an associative array</title>

 </head>
 <body><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="function.ifx-errormsg.html">ifx_errormsg</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="function.ifx-fieldproperties.html">ifx_fieldproperties</a></div>
 <div class="up"><a href="ref.ifx.html">Informix Functions</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div><hr /><div id="function.ifx-fetch-row" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">ifx_fetch_row</h1>
  <p class="verinfo">(PHP 4, PHP &lt;=5.2.0)</p><p class="refpurpose"><span class="refname">ifx_fetch_row</span> &mdash; <span class="dc-title">Get row as an associative array</span></p>

 </div>
 
 <div class="refsect1 description" id="refsect1-function.ifx-fetch-row-description">
  <h3 class="title">Description</h3>
  <div class="methodsynopsis dc-description">
   <span class="type">array</span> <span class="methodname"><strong>ifx_fetch_row</strong></span>
    ( <span class="methodparam"><span class="type">resource</span> <code class="parameter">$result_id</code></span>
   [, <span class="methodparam"><span class="type"><a href="language.pseudo-types.html#language.types.mixed" class="type mixed">mixed</a></span> <code class="parameter">$position</code></span>
  ] )</div>

  <p class="para rdfs-comment">
   Fetches one row of data from the result associated with the specified
   result identifier.
  </p>
  <p class="para">
   Subsequent calls to  <span class="function"><strong>ifx_fetch_row()</strong></span> would return the
   next row in the result set, or <strong><code>FALSE</code></strong> if there are no  more rows.
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-function.ifx-fetch-row-parameters">
  <h3 class="title">Parameters</h3>
  <p class="para">
   <dl>

    <dt>

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

      <p class="para">
       <em><code class="parameter">result_id</code></em> is a valid resultid returned by
        <span class="function"><a href="function.ifx-query.html" class="function">ifx_query()</a></span> or
        <span class="function"><a href="function.ifx-prepare.html" class="function">ifx_prepare()</a></span> (select type queries only!).
      </p>
     </dd>

    </dt>

    <dt>

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

      <p class="para">
       An optional parameter for a &quot;fetch&quot; operation on &quot;scroll&quot; cursors:
       <em>NEXT</em>, <em>PREVIOUS</em>,
       <em>CURRENT</em>, <em>FIRST</em>, 
       <em>LAST</em> or a number.  If you specify a number, an
       &quot;absolute&quot; row fetch is executed.  This parameter is optional, and
       only valid for SCROLL cursors.
      </p>
     </dd>

    </dt>

   </dl>

  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.ifx-fetch-row-returnvalues">
  <h3 class="title">Return Values</h3>
  <p class="para">
   Returns an associative array that corresponds to the fetched row, or
   <strong><code>FALSE</code></strong> if there are no more rows.
  </p>
  <p class="para">
   Blob columns are returned as integer blob id values for use in
    <span class="function"><a href="function.ifx-get-blob.html" class="function">ifx_get_blob()</a></span> unless you have used
   ifx_textasvarchar(1) or ifx_byteasvarchar(1), in which case blobs
   are returned as string values.
  </p>
 </div>


 <div class="refsect1 examples" id="refsect1-function.ifx-fetch-row-examples">
  <h3 class="title">Examples</h3>
  <p class="para">
   <div class="example" id="example-1197">
    <p><strong>Example #1 Informix fetch rows</strong></p>
    <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br />$rid&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">ifx_prepare&nbsp;</span><span style="color: #007700">(</span><span style="color: #DD0000">"select&nbsp;*&nbsp;from&nbsp;emp&nbsp;where&nbsp;name&nbsp;like&nbsp;"&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #0000BB">$name</span><span style="color: #007700">,<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$connid</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">IFX_SCROLL</span><span style="color: #007700">);<br />if&nbsp;(!&nbsp;</span><span style="color: #0000BB">$rid</span><span style="color: #007700">)&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #FF8000">/*&nbsp;...&nbsp;error&nbsp;...&nbsp;*/<br /></span><span style="color: #007700">}<br /></span><span style="color: #0000BB">$rowcount&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">ifx_affected_rows</span><span style="color: #007700">(</span><span style="color: #0000BB">$rid</span><span style="color: #007700">);<br />if&nbsp;(</span><span style="color: #0000BB">$rowcount&nbsp;</span><span style="color: #007700">&gt;&nbsp;</span><span style="color: #0000BB">1000</span><span style="color: #007700">)&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">printf&nbsp;</span><span style="color: #007700">(</span><span style="color: #DD0000">"Too&nbsp;many&nbsp;rows&nbsp;in&nbsp;result&nbsp;set&nbsp;(%d)\n&lt;br&nbsp;/&gt;"</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$rowcount</span><span style="color: #007700">);<br />&nbsp;&nbsp;&nbsp;&nbsp;die&nbsp;(</span><span style="color: #DD0000">"Please&nbsp;restrict&nbsp;your&nbsp;query&lt;br&nbsp;/&gt;\n"</span><span style="color: #007700">);<br />}<br />if&nbsp;(!&nbsp;</span><span style="color: #0000BB">ifx_do&nbsp;</span><span style="color: #007700">(</span><span style="color: #0000BB">$rid</span><span style="color: #007700">))&nbsp;{<br />&nbsp;&nbsp;&nbsp;</span><span style="color: #FF8000">/*&nbsp;...&nbsp;error&nbsp;...&nbsp;*/<br /></span><span style="color: #007700">}<br /></span><span style="color: #0000BB">$row&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">ifx_fetch_row&nbsp;</span><span style="color: #007700">(</span><span style="color: #0000BB">$rid</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"NEXT"</span><span style="color: #007700">);<br />while&nbsp;(</span><span style="color: #0000BB">is_array</span><span style="color: #007700">(</span><span style="color: #0000BB">$row</span><span style="color: #007700">))&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;for&nbsp;(</span><span style="color: #0000BB">reset</span><span style="color: #007700">(</span><span style="color: #0000BB">$row</span><span style="color: #007700">);&nbsp;</span><span style="color: #0000BB">$fieldname</span><span style="color: #007700">=</span><span style="color: #0000BB">key</span><span style="color: #007700">(</span><span style="color: #0000BB">$row</span><span style="color: #007700">);&nbsp;</span><span style="color: #0000BB">next</span><span style="color: #007700">(</span><span style="color: #0000BB">$row</span><span style="color: #007700">))&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$fieldvalue&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">$row</span><span style="color: #007700">[</span><span style="color: #0000BB">$fieldname</span><span style="color: #007700">];<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">printf&nbsp;</span><span style="color: #007700">(</span><span style="color: #DD0000">"%s&nbsp;=&nbsp;%s,"</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$fieldname</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$fieldvalue</span><span style="color: #007700">);<br />&nbsp;&nbsp;&nbsp;&nbsp;}<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">printf</span><span style="color: #007700">(</span><span style="color: #DD0000">"\n&lt;br&nbsp;/&gt;"</span><span style="color: #007700">);<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$row&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">ifx_fetch_row</span><span style="color: #007700">(</span><span style="color: #0000BB">$rid</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"NEXT"</span><span style="color: #007700">);<br />}<br /></span><span style="color: #0000BB">ifx_free_result&nbsp;</span><span style="color: #007700">(</span><span style="color: #0000BB">$rid</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</code></div>
    </div>

   </div>
  </p>
 </div>


</div><hr /><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="function.ifx-errormsg.html">ifx_errormsg</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="function.ifx-fieldproperties.html">ifx_fieldproperties</a></div>
 <div class="up"><a href="ref.ifx.html">Informix Functions</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div></body></html>