uTools-Manuals/docs/php/dbx_fetch_row.html
2019-04-08 23:22:26 +08:00

102 lines
5.6 KiB
HTML

<!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 class="docs"></div>
<div id="layout">
<div id="layout-content"><div id="function.dbx-fetch-row" class="refentry">
<div class="refnamediv">
<h1 class="refname">dbx_fetch_row</h1>
<p class="verinfo">(PHP 5 &lt; 5.1.0, PECL dbx &gt;= 1.1.0)</p><p class="refpurpose"><span class="refname">dbx_fetch_row</span> &mdash; <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">说明</h3>
<div class="methodsynopsis dc-description">
<span class="methodname"><strong>dbx_fetch_row</strong></span>
( <span class="methodparam"><span class="type">object</span> <code class="parameter">$result_identifier</code></span>
) : <span class="type"><a href="language.pseudo-types.html#language.types.mixed" class="type mixed">mixed</a></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">参数</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="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">返回值</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="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="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">范例</h3>
<p class="para">
<div class="example" id="example-974">
<p><strong>Example #1 How to handle the returned value</strong></p>
<div class="example-contents">
<div class="phpcode"><pre><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br />$result&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">dbx_query</span><span style="color: #007700">(</span><span style="color: #0000BB">$link</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'SELECT&nbsp;id,&nbsp;parentid,&nbsp;description&nbsp;FROM&nbsp;table'</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">DBX_RESULT_UNBUFFERED</span><span style="color: #007700">);<br /><br />echo&nbsp;</span><span style="color: #DD0000">"&lt;table&gt;\n"</span><span style="color: #007700">;<br />while&nbsp;(</span><span style="color: #0000BB">$row&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">dbx_fetch_row</span><span style="color: #007700">(</span><span style="color: #0000BB">$result</span><span style="color: #007700">))&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;</span><span style="color: #DD0000">"&lt;tr&gt;\n"</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;foreach&nbsp;(</span><span style="color: #0000BB">$row&nbsp;</span><span style="color: #007700">as&nbsp;</span><span style="color: #0000BB">$field</span><span style="color: #007700">)&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;</span><span style="color: #DD0000">"&lt;td&gt;</span><span style="color: #0000BB">$field</span><span style="color: #DD0000">&lt;/td&gt;"</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;}<br />&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;</span><span style="color: #DD0000">"&lt;/tr&gt;\n"</span><span style="color: #007700">;<br />}<br />echo&nbsp;</span><span style="color: #DD0000">"&lt;/table&gt;\n"</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</pre></div>
</div>
</div>
</p>
</div>
<div class="refsect1 seealso" id="refsect1-function.dbx-fetch-row-seealso">
<h3 class="title">参见</h3>
<p class="para">
<ul class="simplelist">
<li class="member"><span class="function"><a href="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></div></div></body></html>