georg           Mon Apr 22 02:10:45 2002 EDT

  Modified files:              
    /phpdoc/en/reference/mysql/functions        mysql-field-type.xml 
  Log:
  changed example and inserted <screen> section for output
  
  
Index: phpdoc/en/reference/mysql/functions/mysql-field-type.xml
diff -u phpdoc/en/reference/mysql/functions/mysql-field-type.xml:1.2 
phpdoc/en/reference/mysql/functions/mysql-field-type.xml:1.3
--- phpdoc/en/reference/mysql/functions/mysql-field-type.xml:1.2        Wed Apr 17 
02:41:11 2002
+++ phpdoc/en/reference/mysql/functions/mysql-field-type.xml    Mon Apr 22 02:10:44 
+2002
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="iso-8859-1"?>
-<!-- $Revision: 1.2 $ -->
+<!-- $Revision: 1.3 $ -->
 <!-- splitted from ./en/functions/mysql.xml, last change in rev 1.2 -->
   <refentry id="function.mysql-field-type">
    <refnamediv>
@@ -27,28 +27,39 @@
       <programlisting role="php">
 <![CDATA[
 <?php
-mysql_connect("localhost:3306");
-mysql_select_db("wisconsin");
-$result = mysql_query("SELECT * FROM onek");
-$fields = mysql_num_fields($result);
-$rows   = mysql_num_rows($result);
-$i = 0;
-$table = mysql_field_table($result, $i);
-echo "Your '".$table."' table has ".$fields." fields and ".$rows." records <br />";
-echo "The table has the following fields <br />";
-while ($i < $fields) {
-    $type  = mysql_field_type($result, $i);
-    $name  = mysql_field_name($result, $i);
-    $len   = mysql_field_len($result, $i);
-    $flags = mysql_field_flags($result, $i);
-    echo $type." ".$name." ".$len." ".$flags."<br />";
-    $i++;
-}
-mysql_close();
-
+    mysql_connect("localhost", "mysql_username", "mysql_password");
+    mysql_select_db("mysql");
+    $result = mysql_query("SELECT * FROM func");
+    $fields = mysql_num_fields($result);
+    $rows   = mysql_num_rows($result);
+    $table = mysql_field_table($result, 0);
+    echo "Your '".$table."' table has ".$fields." fields and ".$rows." record(s)\n";
+    echo "The table has the following fields:\n";
+    for ($i=0; $i < $fields; $i++) {
+        $type  = mysql_field_type($result, $i);
+        $name  = mysql_field_name($result, $i);
+        $len   = mysql_field_len($result, $i);
+        $flags = mysql_field_flags($result, $i);
+        echo $type." ".$name." ".$len." ".$flags."\n";
+    }
+    mysql_free_result($result);
+    mysql_close();
 ?>
 ]]>
       </programlisting>
+      <para>
+       The abouve example would produce the following output:
+      </para>
+      <screen>
+<![CDATA[
+Your 'func' table has 4 fields and 1 record(s)
+The table has the following fields:
+string name 64 not_null primary_key binary
+int ret 1 not_null
+string dl 128 not_null
+string type 9 not_null enum
+]]>
+      </screen>
      </example>
     </para>
     <para>


Reply via email to