function.dbx-fetch-row.html

来自「php的帮助文档,涉及到PHP的案例和基本语法,以及实际应用内容」· HTML 代码 · 共 113 行

HTML
113
字号
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html> <head>  <title>Fetches rows from a query-result that had the   DBX_RESULT_UNBUFFERED flag set</title>  <meta http-equiv="content-type" content="text/html; charset=UTF-8"> </head> <body><div 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 &lt;= 5.0.5, PECL dbx: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   <b><tt>DBX_RESULT_UNBUFFERED</tt></b> flag set</span></p> </div> <div class="refsect1 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"><b><b>dbx_fetch_row</b></b></span>    ( <span class="methodparam"><span class="type">object</span> <tt class="parameter">$result_identifier</tt></span>   )</div>  <p class="para rdfs-comment">   <b>dbx_fetch_row()</b> fetches rows from a result identifier   that had the <b><tt>DBX_RESULT_UNBUFFERED</tt></b> flag set.  </p>  <p class="para">   When the <b><tt>DBX_RESULT_UNBUFFERED</tt></b> is not set in the    query, <b>dbx_fetch_row()</b> 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    <b>dbx_fetch_row()</b>.  </p> </div> <div class="refsect1 parameters">  <h3 class="title">Parameters</h3>  <p class="para">   <dl>    <dt>     <span class="term"><i><tt class="parameter">result_identifier</tt></i></span>     <dd>      <p class="para">       A result set returned by <a href="function.dbx-query.html" class="function">dbx_query()</a>.      </p>     </dd>    </dt>   </dl>  </p> </div> <div class="refsect1 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 <a href="function.dbx-query.html" class="function">dbx_query()</a> result    <span class="property">data</span> property, including columns accessible by index    or fieldname when the flags for <a href="function.dbx-query.html" class="function">dbx_query()</a> were set   that way.  </p>  <p class="para">   Upon failure, returns <i>0</i> (e.g. when no more rows are   available).  </p> </div> <div class="refsect1 examples">  <h3 class="title">Examples</h3>  <p class="para">   <div class="example">    <p><b>Example #1 How to handle the returned value</b></p>    <div class="example-contents"><div class="phpcode"><code><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;$field&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></code></div>    </div>   </div>  </p> </div> <div class="refsect1 seealso">  <h3 class="title">See Also</h3>  <p class="para">   <ul class="simplelist">    <li class="member"><a href="function.dbx-query.html" class="function" rel="rdfs-seeAlso">dbx_query()</a></li>   </ul>  </p> </div></div><hr /><div 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>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?