<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->

<refentry xml:id="function.cubrid-num-cols" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
 <refnamediv>
  <refname>cubrid_num_cols</refname>
  <refpurpose>Return the number of columns in the result set</refpurpose>
 </refnamediv>

 <refsect1 role="description">
  &reftitle.description;
  <methodsynopsis>
   <type>int</type><methodname>cubrid_num_cols</methodname>
   <methodparam><type>resource</type><parameter>result</parameter></methodparam>  
  </methodsynopsis>
  <para>
    The <function>cubrid_num_cols</function> function is used to get the
    number of columns from the query result. It can only be used when the
    query executed is a <literal>SELECT</literal> statement.
  </para>
</refsect1>

 <refsect1 role="parameters">
  &reftitle.parameters;
  <para>
  <variablelist>
    <varlistentry>
  <term><parameter>result</parameter></term>
  <listitem><para>Result.</para></listitem>
   </varlistentry>
  </variablelist>
  </para>
 </refsect1>

 <refsect1 role="returnvalues">
  &reftitle.returnvalues;
  <para>
    Number of columns, when process is successful.
  </para>
  <para>
    &false;, if SQL statement is not SELECT.
  </para>
 </refsect1>

 <refsect1 role="examples">
  &reftitle.examples;
  <example>
   <title><function>cubrid_num_cols</function> example</title>
   <programlisting role="php">
<![CDATA[
<?php
$conn = cubrid_connect("localhost", 33000, "demodb", "dba");

$req = cubrid_execute($conn, "SELECT * FROM code");

$row_num = cubrid_num_rows($req);
$col_num = cubrid_num_cols($req);

printf("Row Num: %d\nColumn Num: %d\n", $row_num, $col_num);

cubrid_disconnect($conn);
?>
]]>
   </programlisting>
    &example.outputs;
    <screen>
<![CDATA[
Row Num: 6
Column Num: 2
]]>
   </screen>
  </example>
 </refsect1>

 <refsect1 role="seealso">
  &reftitle.seealso;
  <para>
   <simplelist>
    <member><function>cubrid_execute</function></member>  
    <member><function>cubrid_num_rows</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
-->
