mboeren         Wed Apr 18 05:39:17 2001 EDT

  Modified files:              
    /phpdoc/en/functions        dbx.xml 
  Log:
  Fixed examples for dbx_sort, dbx_cmp_asc and dbx_cmp_desc.
  Added the optional comparison_type parameter to dbx_cmp_asc and 
  dbx_cmp_desc (Mc)
  
  
Index: phpdoc/en/functions/dbx.xml
diff -u phpdoc/en/functions/dbx.xml:1.5 phpdoc/en/functions/dbx.xml:1.6
--- phpdoc/en/functions/dbx.xml:1.5     Thu Apr 12 02:06:49 2001
+++ phpdoc/en/functions/dbx.xml Wed Apr 18 05:39:17 2001
@@ -391,7 +391,7 @@
      <programlisting role="php">
 &lt;?php
 function user_re_order ($a, $b) {
-    $rv = dbx_cmp_asc ($a, $b, "parentid");
+    $rv = dbx_cmp_desc ($a, $b, "parentid");
     if (!$rv) $rv = dbx_cmp_asc ($a, $b, "id");
     return $rv;
 }
@@ -400,8 +400,8 @@
     or die ("Could not connect");
 $result = dbx_query ($link, "SELECT id, parentid, description FROM tbl ORDER BY id");
 echo "resulting data is now ordered by id&lt;br>";
-dbx_query ($result, "user_re_order");
-echo "resulting data is now ordered by parentid, then by id&lt;br>";
+dbx_sort ($result, "user_re_order");
+echo "resulting data is now ordered by parentid (descending), then by id&lt;br>";
 dbx_close ($link);
 ?&gt;
      </programlisting>
@@ -426,6 +426,9 @@
       <paramdef>array <parameter>row_a</parameter></paramdef>
       <paramdef>array <parameter>row_b</parameter></paramdef>
       <paramdef>string <parameter>columnname_or_index</parameter></paramdef>
+      <paramdef>int 
+       <parameter><optional>comparison_type</optional></parameter>
+      </paramdef>
      </funcprototype>
     </funcsynopsis>
     <para>
@@ -433,12 +436,17 @@
      row_b[$columnname_or_index], 1 if it is greater and -1 if it is
      smaller.
     </para>
+    <para>
+     The <parameter>comparison_type</parameter> parameter can be used 
+     to force a numeric compare (by setting it to DBX_CMP_NUMBER). The default 
+     comparison is by text (e.g. "20" is greater than "100").
+    </para>
     <example>
      <title><function>dbx_cmp_asc</function> example</title>
      <programlisting role="php">
 &lt;?php
 function user_re_order ($a, $b) {
-    $rv = dbx_cmp_asc ($a, $b, "parentid");
+    $rv = dbx_cmp_desc ($a, $b, "parentid");
     if (!$rv) { 
         $rv = dbx_cmp_asc ($a, $b, "id");
         return $rv;
@@ -449,8 +457,8 @@
     or die ("Could not connect");
 $result = dbx_query ($link, "SELECT id, parentid, description FROM tbl ORDER BY id");
 echo "resulting data is now ordered by id&lt;br>";
-dbx_query ($result, "user_re_order");
-echo "resulting data is now ordered by parentid, then by id&lt;br>";
+dbx_sort ($result, "user_re_order");
+echo "resulting data is now ordered by parentid (descending), then by id&lt;br>";
 dbx_close ($link);
 ?&gt;
      </programlisting>
@@ -474,8 +482,9 @@
       <funcdef>int <function>dbx_cmp_desc</function></funcdef>
       <paramdef>array <parameter>row_a</parameter></paramdef>
       <paramdef>array <parameter>row_b</parameter></paramdef>
-      <paramdef>string 
-       <parameter>columnname_or_index</parameter>
+      <paramdef>string <parameter>columnname_or_index</parameter></paramdef>
+      <paramdef>int 
+       <parameter><optional>comparison_type</optional></parameter>
       </paramdef>
      </funcprototype>
     </funcsynopsis>
@@ -484,12 +493,17 @@
      row_b[$columnname_or_index], -1 if it is greater and 1 if it is
      smaller.
     </para>
+    <para>
+     The <parameter>comparison_type</parameter> parameter can be used 
+     to force a numeric compare (by setting it to DBX_CMP_NUMBER). The default 
+     comparison is by text (e.g. "20" is greater than "100").
+    </para>
     <example>
      <title><function>dbx_cmp_desc</function> example</title>
      <programlisting role="php">
 &lt;?php
 function user_re_order ($a, $b) {
-    $rv = dbx_cmp_asc ($a, $b, "parentid");
+    $rv = dbx_cmp_desc ($a, $b, "parentid");
     if (!$rv) {
         $rv = dbx_cmp_asc($a, $b, "id");
         return $rv;
@@ -500,8 +514,8 @@
     or die ("Could not connect");
 $result = dbx_query ($link, "SELECT id, parentid, description FROM tbl ORDER BY id");
 echo "resulting data is now ordered by id&lt;br>";
-dbx_query ($result, "user_re_order");
-echo "resulting data is now ordered by parentid, then by id&lt;br>";
+dbx_sort ($result, "user_re_order");
+echo "resulting data is now ordered by parentid (descending), then by id&lt;br>";
 dbx_close ($link);
 ?&gt;
      </programlisting>


Reply via email to