2002-04-15 00:12:54 +00:00
|
|
|
<?xml version="1.0" encoding="iso-8859-1"?>
|
2004-04-01 08:11:29 +00:00
|
|
|
<!-- $Revision: 1.2 $ -->
|
2004-03-08 14:12:17 +00:00
|
|
|
<refentry id="function.oci-num-fields">
|
2002-04-15 00:12:54 +00:00
|
|
|
<refnamediv>
|
2004-03-08 14:12:17 +00:00
|
|
|
<refname>oci_num_fields</refname>
|
2002-04-15 00:12:54 +00:00
|
|
|
<refpurpose>
|
2004-03-08 14:12:17 +00:00
|
|
|
Returns the number of result columns in a statement
|
2002-04-15 00:12:54 +00:00
|
|
|
</refpurpose>
|
|
|
|
</refnamediv>
|
|
|
|
<refsect1>
|
|
|
|
<title>Description</title>
|
|
|
|
<methodsynopsis>
|
2004-03-08 14:12:17 +00:00
|
|
|
<type>int</type><methodname>oci_num_fields</methodname>
|
|
|
|
<methodparam><type>resource</type><parameter>statement</parameter></methodparam>
|
2002-04-15 00:12:54 +00:00
|
|
|
</methodsynopsis>
|
|
|
|
<para>
|
2004-03-08 14:12:17 +00:00
|
|
|
<function>oci_num_fields</function> returns the number of columns in the
|
|
|
|
<parameter>statement</parameter>.
|
2002-04-15 00:12:54 +00:00
|
|
|
</para>
|
2003-08-12 08:56:59 +00:00
|
|
|
<para>
|
|
|
|
<example>
|
2004-03-08 14:12:17 +00:00
|
|
|
<title><function>oci_num_fields</function> example</title>
|
2003-08-16 16:59:40 +00:00
|
|
|
<programlisting role="php">
|
2002-04-15 00:12:54 +00:00
|
|
|
<![CDATA[
|
|
|
|
<?php
|
2003-12-15 16:55:22 +00:00
|
|
|
echo "<pre>\n";
|
2004-03-08 14:12:17 +00:00
|
|
|
$conn = oci_connect("scott", "tiger");
|
|
|
|
$stmt = oci_parse($conn, "select * from emp");
|
|
|
|
|
|
|
|
oci_execute($stmt);
|
|
|
|
|
|
|
|
while (oci_fetch($stmt)) {
|
2003-12-15 16:55:22 +00:00
|
|
|
echo "\n";
|
2004-03-08 14:12:17 +00:00
|
|
|
$ncols = oci_num_fields($stmt);
|
2003-12-15 16:55:22 +00:00
|
|
|
for ($i = 1; $i <= $ncols; $i++) {
|
2004-03-08 14:12:17 +00:00
|
|
|
$column_name = oci_field_name($stmt, $i);
|
|
|
|
$column_value = oci_result($stmt, $i);
|
2003-12-15 16:55:22 +00:00
|
|
|
echo $column_name . ': ' . $column_value . "\n";
|
2002-04-15 00:12:54 +00:00
|
|
|
}
|
2003-12-15 16:55:22 +00:00
|
|
|
echo "\n";
|
2002-04-15 00:12:54 +00:00
|
|
|
}
|
2004-03-08 14:12:17 +00:00
|
|
|
|
|
|
|
oci_free_statement($stmt);
|
|
|
|
oci_close($conn);
|
|
|
|
|
2003-12-15 16:55:22 +00:00
|
|
|
echo "</pre>";
|
2002-04-15 00:12:54 +00:00
|
|
|
?>
|
|
|
|
]]>
|
2003-08-12 08:56:59 +00:00
|
|
|
</programlisting>
|
|
|
|
</example>
|
|
|
|
</para>
|
2004-03-08 14:12:17 +00:00
|
|
|
<para>
|
|
|
|
<function>oci_num_fields</function> returns &false; on error.
|
|
|
|
</para>
|
2004-04-01 08:11:29 +00:00
|
|
|
<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>
|
2002-04-15 00:12:54 +00:00
|
|
|
</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
|
|
|
|
-->
|