<?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.6 $ --> <!-- splitted from ./en/functions/mysql.xml, last change in rev 1.2 --> <refentry id="function.mysql-num-fields"> <refnamediv> <refname>mysql_num_fields</refname> <refpurpose>Get number of fields in result</refpurpose> </refnamediv> <refsect1> <title>Description</title> <methodsynopsis> <type>int</type><methodname>mysql_num_fields</methodname> <methodparam><type>resource</type><parameter>result</parameter></methodparam> </methodsynopsis> <para> <function>mysql_num_fields</function> returns the number of fields in the result set <parameter>result</parameter>. </para> <para> <example> <title>A <function>mysql_num_fields</function> example</title> <programlisting role="php"> <![CDATA[ <?php $result = mysql_query("SELECT id,email FROM people WHERE id = '42'"); if (!$result) { echo 'Could not run query: ' . mysql_error(); exit; } /* returns 2 because id,email === two fields */ echo mysql_num_fields($result); ?> ]]> </programlisting> </example> </para> <para> For downward compatibility <function>mysql_numfields</function> can also be used. This is deprecated however. </para> <para> See also <function>mysql_select_db</function>, <function>mysql_query</function>, <function>mysql_fetch_field</function> and <function>mysql_num_rows</function>. </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:"../../../../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 -->