nlopess         Fri Feb 18 05:58:17 2005 EDT

  Modified files:              
    /phpdoc/en/reference/msql/functions msql-data-seek.xml 
                                        msql-fetch-array.xml 
                                        msql-fetch-object.xml 
                                        msql-fetch-row.xml 
  Log:
  commit 'danielc at analysisandsolutions dot com' patch (modified) as per bug 
#32016
  documenting the second parameter on msql_fetch_* functions and add an example
  
http://cvs.php.net/diff.php/phpdoc/en/reference/msql/functions/msql-data-seek.xml?r1=1.6&r2=1.7&ty=u
Index: phpdoc/en/reference/msql/functions/msql-data-seek.xml
diff -u phpdoc/en/reference/msql/functions/msql-data-seek.xml:1.6 
phpdoc/en/reference/msql/functions/msql-data-seek.xml:1.7
--- phpdoc/en/reference/msql/functions/msql-data-seek.xml:1.6   Tue Mar  2 
05:16:06 2004
+++ phpdoc/en/reference/msql/functions/msql-data-seek.xml       Fri Feb 18 
05:58:15 2005
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="iso-8859-1"?>
-<!-- $Revision: 1.6 $ -->
+<!-- $Revision: 1.7 $ -->
 <!-- splitted from ./en/functions/msql.xml, last change in rev 1.2 -->
   <refentry id="function.msql-data-seek">
    <refnamediv>
@@ -25,7 +25,10 @@
     </para>
     <para> 
      See also
-     <function>msql_fetch_row</function>.
+     <function>msql_fetch_array</function>,
+     <function>msql_fetch_object</function>,
+     <function>msql_fetch_row</function> and
+     <function>msql_result</function>.
     </para>
    </refsect1>
   </refentry>
http://cvs.php.net/diff.php/phpdoc/en/reference/msql/functions/msql-fetch-array.xml?r1=1.5&r2=1.6&ty=u
Index: phpdoc/en/reference/msql/functions/msql-fetch-array.xml
diff -u phpdoc/en/reference/msql/functions/msql-fetch-array.xml:1.5 
phpdoc/en/reference/msql/functions/msql-fetch-array.xml:1.6
--- phpdoc/en/reference/msql/functions/msql-fetch-array.xml:1.5 Tue Mar  2 
05:17:01 2004
+++ phpdoc/en/reference/msql/functions/msql-fetch-array.xml     Fri Feb 18 
05:58:16 2005
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="iso-8859-1"?>
-<!-- $Revision: 1.5 $ -->
+<!-- $Revision: 1.6 $ -->
 <!-- splitted from ./en/functions/msql.xml, last change in rev 1.2 -->
   <refentry id="function.msql-fetch-array">
    <refnamediv>
@@ -9,8 +9,8 @@
    <refsect1>
     <title>Description</title>
      <methodsynopsis>
-      <type>int</type><methodname>msql_fetch_array</methodname>
-      
<methodparam><type>int</type><parameter>query_identifier</parameter></methodparam>
+      <type>array</type><methodname>msql_fetch_array</methodname>
+      
<methodparam><type>resource</type><parameter>query_identifier</parameter></methodparam>
       <methodparam 
choice="opt"><type>int</type><parameter>result_type</parameter></methodparam>
      </methodsynopsis>
     <para>
@@ -25,25 +25,60 @@
     </para>
     <para>
      The second optional argument <parameter>result_type</parameter>
-     in <function>msql_fetch_array</function> is a constant and can
-     take the following values: MSQL_ASSOC, MSQL_NUM, and MSQL_BOTH with
-     MSQL_BOTH being the default.
+     is a constant and can take the following values:
+     <constant>MSQL_ASSOC</constant>, <constant>MSQL_NUM</constant>, and
+     <constant>MSQL_BOTH</constant> with <constant>MSQL_BOTH</constant> being
+     the default.
     </para>
-    <para>
-     Be careful if you are retrieving results from a query that may
-     return a record that contains only one field that has a value of
-     0 (or an empty string, or &null;).
-    </para>  
     <para> 
      An important thing to note is that using
      <function>msql_fetch_array</function> is NOT significantly slower
      than using <function>msql_fetch_row</function>, while it provides
      a significant added value.
     </para>  
+    <warning>
+     <simpara>
+      In PHP versions prior to 4.3.11 and 5.0.4 a bug existed
+      when retrieving data from columns containing &null; values.
+      Such columns were not placed into the resulting array.
+     </simpara>
+    </warning>
+    <para>
+     <example>
+      <title><function>msql_fetch_array</function> example</title>
+      <programlisting role="php">
+<![CDATA[
+<?php
+$con = msql_connect();
+if (!$con) {
+    die('Server connection problem: ' . msql_error());
+}
+
+if (!msql_select_db('test', $con)) {
+    die('Database connection problem: ' . msql_error());
+}
+
+$result = msql_query('SELECT id, name FROM people', $con);
+if (!$result) {
+    die('Query execution problem: ' . msql_error());
+}
+
+while ($row = msql_fetch_array($result, MSQL_ASSOC)) {
+    echo $row['id'] . ': ' . $row['name'] . "\n";
+}
+
+msql_free_result($result);
+?>
+]]>
+      </programlisting>
+     </example>
+    </para>
     <para>
      See also
-     <function>msql_fetch_row</function> and
-     <function>msql_fetch_object</function>.
+     <function>msql_fetch_row</function>,
+     <function>msql_fetch_object</function>,
+     <function>msql_data_seek</function> and
+     <function>msql_result</function>.
     </para>
    </refsect1>
   </refentry>
http://cvs.php.net/diff.php/phpdoc/en/reference/msql/functions/msql-fetch-object.xml?r1=1.3&r2=1.4&ty=u
Index: phpdoc/en/reference/msql/functions/msql-fetch-object.xml
diff -u phpdoc/en/reference/msql/functions/msql-fetch-object.xml:1.3 
phpdoc/en/reference/msql/functions/msql-fetch-object.xml:1.4
--- phpdoc/en/reference/msql/functions/msql-fetch-object.xml:1.3        Tue Mar 
 2 05:16:06 2004
+++ phpdoc/en/reference/msql/functions/msql-fetch-object.xml    Fri Feb 18 
05:58:16 2005
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="iso-8859-1"?>
-<!-- $Revision: 1.3 $ -->
+<!-- $Revision: 1.4 $ -->
 <!-- splitted from ./en/functions/msql.xml, last change in rev 1.2 -->
   <refentry id="function.msql-fetch-object">
    <refnamediv>
@@ -9,8 +9,9 @@
    <refsect1>
     <title>Description</title>
      <methodsynopsis>
-      <type>int</type><methodname>msql_fetch_object</methodname>
-      
<methodparam><type>int</type><parameter>query_identifier</parameter></methodparam>
+      <type>object</type><methodname>msql_fetch_object</methodname>
+      
<methodparam><type>resource</type><parameter>query_identifier</parameter></methodparam>
+      <methodparam 
choice="opt"><type>int</type><parameter>result_type</parameter></methodparam>
      </methodsynopsis>
     <para>
      Returns an object with properties that correspond to the fetched
@@ -24,15 +25,61 @@
      their offsets (numbers are illegal property names).
     </para>  
     <para>
+     The second optional argument <parameter>result_type</parameter>
+     is a constant and can take the following values:
+     <constant>MSQL_ASSOC</constant>, <constant>MSQL_NUM</constant>, and
+     <constant>MSQL_BOTH</constant> with <constant>MSQL_BOTH</constant> being
+     the default.
+    </para>
+    <para>
      Speed-wise, the function is identical to
      <function>msql_fetch_array</function>, and almost as quick as
      <function>msql_fetch_row</function> (the difference is
      insignificant).
     </para>  
+    <warning>
+     <simpara>
+      In PHP versions prior to 4.3.11 and 5.0.4 a bug existed
+      when retrieving data from columns containing &null; values.
+      Such columns were not placed into the resulting array.
+     </simpara>
+    </warning>
+    <para>
+     <example>
+      <title><function>msql_fetch_object</function> example</title>
+      <programlisting role="php">
+<![CDATA[
+<?php
+$con = msql_connect();
+if (!$con) {
+    die('Server connection problem: ' . msql_error());
+}
+
+if (!msql_select_db('test', $con)) {
+    die('Database connection problem: ' . msql_error());
+}
+
+$result = msql_query('SELECT id, name FROM people', $con);
+if (!$result) {
+    die('Query execution problem: ' . msql_error());
+}
+
+while ($row = msql_fetch_object($result, MSQL_ASSOC)) {
+    echo $row->id . ': ' . $row->name . "\n";
+}
+
+msql_free_result($result);
+?>
+]]>
+      </programlisting>
+     </example>
+    </para>
     <para>
-     See also:
-     <function>msql_fetch_array</function> and
-     <function>msql_fetch_row</function>.
+     See also
+     <function>msql_fetch_array</function>,
+     <function>msql_fetch_row</function>,
+     <function>msql_data_seek</function> and
+     <function>msql_result</function>.
     </para>
    </refsect1>
   </refentry>
http://cvs.php.net/diff.php/phpdoc/en/reference/msql/functions/msql-fetch-row.xml?r1=1.3&r2=1.4&ty=u
Index: phpdoc/en/reference/msql/functions/msql-fetch-row.xml
diff -u phpdoc/en/reference/msql/functions/msql-fetch-row.xml:1.3 
phpdoc/en/reference/msql/functions/msql-fetch-row.xml:1.4
--- phpdoc/en/reference/msql/functions/msql-fetch-row.xml:1.3   Tue Mar  2 
05:16:06 2004
+++ phpdoc/en/reference/msql/functions/msql-fetch-row.xml       Fri Feb 18 
05:58:16 2005
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="iso-8859-1"?>
-<!-- $Revision: 1.3 $ -->
+<!-- $Revision: 1.4 $ -->
 <!-- splitted from ./en/functions/msql.xml, last change in rev 1.2 -->
   <refentry id="function.msql-fetch-row">
    <refnamediv>
@@ -11,6 +11,7 @@
      <methodsynopsis>
       <type>array</type><methodname>msql_fetch_row</methodname>
       
<methodparam><type>resource</type><parameter>query_identifier</parameter></methodparam>
+      <methodparam 
choice="opt"><type>int</type><parameter>result_type</parameter></methodparam>
      </methodsynopsis>
     <para>
      Returns an array that corresponds to the fetched row, or &false; if
@@ -27,10 +28,55 @@
      return the next row in the result set, or &false; if there are no
      more rows.
     </para>
+    <para>
+     The second optional argument <parameter>result_type</parameter>
+     is a constant and can take the following values:
+     <constant>MSQL_ASSOC</constant>, <constant>MSQL_NUM</constant>, and
+     <constant>MSQL_BOTH</constant> with <constant>MSQL_NUM</constant> being
+     the default.
+    </para>
+    <warning>
+     <simpara>
+      In PHP versions prior to 4.3.11 and 5.0.4 a bug existed
+      when retrieving data from columns containing &null; values.
+      Such columns were not placed into the resulting array.
+     </simpara>
+    </warning>
+    <para>
+     <example>
+      <title><function>msql_fetch_row</function> example</title>
+      <programlisting role="php">
+<![CDATA[
+<?php
+$con = msql_connect();
+if (!$con) {
+    die('Server connection problem: ' . msql_error());
+}
+
+if (!msql_select_db('test', $con)) {
+    die('Database connection problem: ' . msql_error());
+}
+
+$result = msql_query('SELECT id, name FROM people', $con);
+if (!$result) {
+    die('Query execution problem: ' . msql_error());
+}
+
+while ($row = msql_fetch_row($result)) {
+    echo $row[0] . ': ' . $row[1] . "\n";
+}
+
+msql_free_result($result);
+?>
+]]>
+      </programlisting>
+     </example>
+    </para>
     <para> 
-     See also: <function>msql_fetch_array</function>,
+     See also
+     <function>msql_fetch_array</function>,
      <function>msql_fetch_object</function>,
-     <function>msql_data_seek</function>, and
+     <function>msql_data_seek</function> and
      <function>msql_result</function>.
     </para>
    </refsect1>

Reply via email to