mirror of
https://github.com/fofolee/uTools-Manuals.git
synced 2025-06-18 13:57:03 +08:00
102 lines
5.6 KiB
HTML
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 < 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">说明</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"><?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>
|
|
</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> |