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

116 lines
4.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>Get result data</title>
</head>
<body class="docs"><div id="layout">
<div id="layout-content"><div id="function.odbc-result" class="refentry">
<div class="refnamediv">
<h1 class="refname">odbc_result</h1>
<p class="verinfo">(PHP 4, PHP 5, PHP 7)</p><p class="refpurpose"><span class="refname">odbc_result</span> &mdash; <span class="dc-title">Get result data</span></p>
</div>
<div class="refsect1 description" id="refsect1-function.odbc-result-description">
<h3 class="title">说明</h3>
<div class="methodsynopsis dc-description">
<span class="methodname"><strong>odbc_result</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">$field</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">
Get result data
</p>
</div>
<div class="refsect1 parameters" id="refsect1-function.odbc-result-parameters">
<h3 class="title">参数</h3>
<p class="para">
<dl>
<dt>
<code class="parameter">result_id</code></dt>
<dd>
<p class="para">
The ODBC <span class="type"><a href="language.types.resource.html" class="type resource">resource</a></span>.
</p>
</dd>
<dt>
<code class="parameter">field</code></dt>
<dd>
<p class="para">
The field name being retrieved. It can either be an integer containing
the column number of the field you want; or it can be a string
containing the name of the field.
</p>
</dd>
</dl>
</p>
</div>
<div class="refsect1 returnvalues" id="refsect1-function.odbc-result-returnvalues">
<h3 class="title">返回值</h3>
<p class="para">
Returns the string contents of the field, <strong><code>FALSE</code></strong> on error, <strong><code>NULL</code></strong> for
NULL data, or <strong><code>TRUE</code></strong> for binary data.
</p>
</div>
<div class="refsect1 examples" id="refsect1-function.odbc-result-examples">
<h3 class="title">范例</h3>
<p class="para">
The first call to <span class="function"><strong>odbc_result()</strong></span> returns the
value of the third field in the current record of the query
result. The second function call to
<span class="function"><strong>odbc_result()</strong></span> returns the value of the field
whose field name is &quot;val&quot; in the current record of the query
result. An error occurs if a column number parameter for a field
is less than one or exceeds the number of columns (or fields) in
the current record. Similarly, an error occurs if a field with a
name that is not one of the fieldnames of the table(s) that
is(are) being queried.
</p>
<p class="para">
<div class="example" id="example-985">
<p><strong>Example #1 <span class="function"><strong>odbc_result()</strong></span> examples</strong></p>
<div class="example-contents">
<div class="phpcode"><pre><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br />$item_3&nbsp;&nbsp;&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">odbc_result</span><span style="color: #007700">(</span><span style="color: #0000BB">$Query_ID</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">3</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$item_val&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">odbc_result</span><span style="color: #007700">(</span><span style="color: #0000BB">$Query_ID</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"val"</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</pre></div>
</div>
</div>
</p>
</div>
<div class="refsect1 notes" id="refsect1-function.odbc-result-notes">
<h3 class="title">注释</h3>
<p class="para">
Field indices start from 1. Regarding the way binary or
long column data is returned refer to
<span class="function"><a href="odbc_binmode.html" class="function">odbc_binmode()</a></span> and
<span class="function"><a href="odbc_longreadlen.html" class="function">odbc_longreadlen()</a></span>.
</p>
</div>
</div></div></div></body></html>