php-doc-en/reference/oci8/functions/oci-num-fields.xml
2004-04-01 08:11:29 +00:00

85 lines
2.3 KiB
XML

<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.2 $ -->
<refentry id="function.oci-num-fields">
<refnamediv>
<refname>oci_num_fields</refname>
<refpurpose>
Returns the number of result columns in a statement
</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>int</type><methodname>oci_num_fields</methodname>
<methodparam><type>resource</type><parameter>statement</parameter></methodparam>
</methodsynopsis>
<para>
<function>oci_num_fields</function> returns the number of columns in the
<parameter>statement</parameter>.
</para>
<para>
<example>
<title><function>oci_num_fields</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
echo "<pre>\n";
$conn = oci_connect("scott", "tiger");
$stmt = oci_parse($conn, "select * from emp");
oci_execute($stmt);
while (oci_fetch($stmt)) {
echo "\n";
$ncols = oci_num_fields($stmt);
for ($i = 1; $i <= $ncols; $i++) {
$column_name = oci_field_name($stmt, $i);
$column_value = oci_result($stmt, $i);
echo $column_name . ': ' . $column_value . "\n";
}
echo "\n";
}
oci_free_statement($stmt);
oci_close($conn);
echo "</pre>";
?>
]]>
</programlisting>
</example>
</para>
<para>
<function>oci_num_fields</function> returns &false; on error.
</para>
<note>
<para>
In PHP versions before 5.0.0 you must use <function>ocinumcols</function> instead.
This name still can be used, it was left as alias of
<function>oci_num_fields</function> for downwards compatability.
This, however, is deprecated and not recommended.
</para>
</note>
</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:"../../../../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
-->