philip          Mon Jul 19 22:00:38 2004 EDT

  Modified files:              
    /phpdoc/en/reference/mysql/functions        mysql-num-fields.xml 
  Log:
  Added an example and moved see also to the bottom.
  
  
http://cvs.php.net/diff.php/phpdoc/en/reference/mysql/functions/mysql-num-fields.xml?r1=1.5&r2=1.6&ty=u
Index: phpdoc/en/reference/mysql/functions/mysql-num-fields.xml
diff -u phpdoc/en/reference/mysql/functions/mysql-num-fields.xml:1.5 
phpdoc/en/reference/mysql/functions/mysql-num-fields.xml:1.6
--- phpdoc/en/reference/mysql/functions/mysql-num-fields.xml:1.5        Wed Jul  9 
11:07:29 2003
+++ phpdoc/en/reference/mysql/functions/mysql-num-fields.xml    Mon Jul 19 22:00:38 
2004
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="iso-8859-1"?>
-<!-- $Revision: 1.5 $ -->
+<!-- $Revision: 1.6 $ -->
 <!-- splitted from ./en/functions/mysql.xml, last change in rev 1.2 -->
   <refentry id="function.mysql-num-fields">
    <refnamediv>
@@ -17,15 +17,34 @@
      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>
-    <para>
-     For downward compatibility <function>mysql_numfields</function>
-     can also be used. This is deprecated however.
     </para>
    </refsect1>
   </refentry>

Reply via email to