php-doc-en/reference/oci8/functions/oci-result.xml
2013-12-04 19:26:45 +00:00

141 lines
3.6 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xml:id="function.oci-result" xmlns="http://docbook.org/ns/docbook">
<refnamediv>
<refname>oci_result</refname>
<refpurpose>Returns field's value from the fetched row</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type>mixed</type><methodname>oci_result</methodname>
<methodparam><type>resource</type><parameter>statement</parameter></methodparam>
<methodparam><type>mixed</type><parameter>field</parameter></methodparam>
</methodsynopsis>
<para>
Returns the data from <parameter>field</parameter> in the current row,
fetched by <function>oci_fetch</function>.
</para>
&oci.datatypes;
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>statement</parameter></term>
<listitem>
<para>
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>field</parameter></term>
<listitem>
<para>
Can be either use the column number (1-based) or the column name.
The case of the column name must be the case that Oracle meta data
describes the column as, which is uppercase for columns created
case insensitively.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Returns everything as strings except for abstract types (ROWIDs, LOBs and
FILEs). Returns &false; on error.
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title><function>oci_fetch</function> with <function>oci_result</function></title>
<programlisting role="php">
<![CDATA[
<?php
$conn = oci_connect('hr', 'welcome', 'localhost/XE');
if (!$conn) {
$e = oci_error();
trigger_error(htmlentities($e['message'], ENT_QUOTES), E_USER_ERROR);
}
$sql = 'SELECT location_id, city FROM locations WHERE location_id < 1200';
$stid = oci_parse($conn, $sql);
oci_execute($stid);
while (oci_fetch($stid)) {
echo oci_result($stid, 'LOCATION_ID') . " is ";
echo oci_result($stid, 'CITY') . "<br>\n";
}
// Displays:
// 1000 is Roma
// 1100 is Venice
oci_free_statement($stid);
oci_close($conn);
?>
]]>
</programlisting>
</example>
</para>
</refsect1>
<refsect1 role="notes">
&reftitle.notes;
<note>
<para>
In PHP versions before 5.0.0 you must use <function>ociresult</function> instead.
This name still can be used, it was left as alias of
<function>oci_result</function> for downwards compatability.
This, however, is deprecated and not recommended.
</para>
</note>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><function>oci_fetch_array</function></member>
<member><function>oci_fetch_assoc</function></member>
<member><function>oci_fetch_object</function></member>
<member><function>oci_fetch_row</function></member>
<member><function>oci_fetch_all</function></member>
</simplelist>
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->