<!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><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="function.odbc-result-all.html">odbc_result_all</a></div> <div class="next" style="text-align: right; float: right;"><a href="function.odbc-rollback.html">odbc_rollback</a></div> <div class="up"><a href="ref.uodbc.html">ODBC Functions</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div><hr /><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> — <span class="dc-title">Get result data</span></p> </div> <div class="refsect1 description" id="refsect1-function.odbc-result-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>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> )</div> <p class="para rdfs-comment"> Get result data </p> </div> <div class="refsect1 parameters" id="refsect1-function.odbc-result-parameters"> <h3 class="title">Parameters</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">Return Values</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">Examples</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 "val" 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-1017"> <p><strong>Example #1 <span class="function"><strong>odbc_result()</strong></span> examples</strong></p> <div class="example-contents"> <div class="phpcode"><code><span style="color: #000000"> <span style="color: #0000BB"><?php<br />$item_3 </span><span style="color: #007700">= </span><span style="color: #0000BB">odbc_result</span><span style="color: #007700">(</span><span style="color: #0000BB">$Query_ID</span><span style="color: #007700">, </span><span style="color: #0000BB">3</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$item_val </span><span style="color: #007700">= </span><span style="color: #0000BB">odbc_result</span><span style="color: #007700">(</span><span style="color: #0000BB">$Query_ID</span><span style="color: #007700">, </span><span style="color: #DD0000">"val"</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">?></span> </span> </code></div> </div> </div> </p> </div> <div class="refsect1 notes" id="refsect1-function.odbc-result-notes"> <h3 class="title">Notes</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="function.odbc-binmode.html" class="function">odbc_binmode()</a></span> and <span class="function"><a href="function.odbc-longreadlen.html" class="function">odbc_longreadlen()</a></span>. </p> </div> </div><hr /><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="function.odbc-result-all.html">odbc_result_all</a></div> <div class="next" style="text-align: right; float: right;"><a href="function.odbc-rollback.html">odbc_rollback</a></div> <div class="up"><a href="ref.uodbc.html">ODBC Functions</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div></body></html>