<!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>Fetches rows from a query-result that had the DBX_RESULT_UNBUFFERED flag set</title> </head> <body><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="function.dbx-escape-string.html">dbx_escape_string</a></div> <div class="next" style="text-align: right; float: right;"><a href="function.dbx-query.html">dbx_query</a></div> <div class="up"><a href="ref.dbx.html">dbx Functions</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div><hr /><div id="function.dbx-fetch-row" class="refentry"> <div class="refnamediv"> <h1 class="refname">dbx_fetch_row</h1> <p class="verinfo">(PHP 5 < 5.1.0, PECL dbx >= 1.1.0)</p><p class="refpurpose"><span class="refname">dbx_fetch_row</span> — <span class="dc-title">Fetches rows from a query-result that had the <strong><code>DBX_RESULT_UNBUFFERED</code></strong> flag set</span></p> </div> <div class="refsect1 description" id="refsect1-function.dbx-fetch-row-description"> <h3 class="title">Description</h3> <div class="methodsynopsis dc-description"> <span class="type"><a href="language.pseudo-types.html#language.types.mixed" class="type mixed">mixed</a></span> <span class="methodname"><strong>dbx_fetch_row</strong></span> ( <span class="methodparam"><span class="type">object</span> <code class="parameter">$result_identifier</code></span> )</div> <p class="para rdfs-comment"> <span class="function"><strong>dbx_fetch_row()</strong></span> fetches rows from a result identifier that had the <strong><code>DBX_RESULT_UNBUFFERED</code></strong> flag set. </p> <p class="para"> When the <strong><code>DBX_RESULT_UNBUFFERED</code></strong> is not set in the query, <span class="function"><strong>dbx_fetch_row()</strong></span> will fail as all rows have already been fetched into the results <span class="property">data</span> property. </p> <p class="para"> As a side effect, the <span class="property">rows</span> property of the query-result object is incremented for each successful call to <span class="function"><strong>dbx_fetch_row()</strong></span>. </p> </div> <div class="refsect1 parameters" id="refsect1-function.dbx-fetch-row-parameters"> <h3 class="title">Parameters</h3> <p class="para"> <dl> <dt> <code class="parameter">result_identifier</code></dt> <dd> <p class="para"> A result set returned by <span class="function"><a href="function.dbx-query.html" class="function">dbx_query()</a></span>. </p> </dd> </dl> </p> </div> <div class="refsect1 returnvalues" id="refsect1-function.dbx-fetch-row-returnvalues"> <h3 class="title">Return Values</h3> <p class="para"> Returns an object on success that contains the same information as any row would have in the <span class="function"><a href="function.dbx-query.html" class="function">dbx_query()</a></span> result <span class="property">data</span> property, including columns accessible by index or fieldname when the flags for <span class="function"><a href="function.dbx-query.html" class="function">dbx_query()</a></span> were set that way. </p> <p class="para"> Upon failure, returns <em>0</em> (e.g. when no more rows are available). </p> </div> <div class="refsect1 examples" id="refsect1-function.dbx-fetch-row-examples"> <h3 class="title">Examples</h3> <p class="para"> <div class="example" id="example-1006"> <p><strong>Example #1 How to handle the returned value</strong></p> <div class="example-contents"> <div class="phpcode"><code><span style="color: #000000"> <span style="color: #0000BB"><?php<br />$result </span><span style="color: #007700">= </span><span style="color: #0000BB">dbx_query</span><span style="color: #007700">(</span><span style="color: #0000BB">$link</span><span style="color: #007700">, </span><span style="color: #DD0000">'SELECT id, parentid, description FROM table'</span><span style="color: #007700">, </span><span style="color: #0000BB">DBX_RESULT_UNBUFFERED</span><span style="color: #007700">);<br /><br />echo </span><span style="color: #DD0000">"<table>\n"</span><span style="color: #007700">;<br />while (</span><span style="color: #0000BB">$row </span><span style="color: #007700">= </span><span style="color: #0000BB">dbx_fetch_row</span><span style="color: #007700">(</span><span style="color: #0000BB">$result</span><span style="color: #007700">)) {<br /> echo </span><span style="color: #DD0000">"<tr>\n"</span><span style="color: #007700">;<br /> foreach (</span><span style="color: #0000BB">$row </span><span style="color: #007700">as </span><span style="color: #0000BB">$field</span><span style="color: #007700">) {<br /> echo </span><span style="color: #DD0000">"<td></span><span style="color: #0000BB">$field</span><span style="color: #DD0000"></td>"</span><span style="color: #007700">;<br /> }<br /> echo </span><span style="color: #DD0000">"</tr>\n"</span><span style="color: #007700">;<br />}<br />echo </span><span style="color: #DD0000">"</table>\n"</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">?></span> </span> </code></div> </div> </div> </p> </div> <div class="refsect1 seealso" id="refsect1-function.dbx-fetch-row-seealso"> <h3 class="title">See Also</h3> <p class="para"> <ul class="simplelist"> <li class="member"><span class="function"><a href="function.dbx-query.html" class="function" rel="rdfs-seeAlso">dbx_query()</a> - Send a query and fetch all results (if any)</span></li> </ul> </p> </div> </div><hr /><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="function.dbx-escape-string.html">dbx_escape_string</a></div> <div class="next" style="text-align: right; float: right;"><a href="function.dbx-query.html">dbx_query</a></div> <div class="up"><a href="ref.dbx.html">dbx Functions</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div></body></html>