dbs             Thu Feb 10 20:31:13 2005 EDT

  Modified files:              
    /phpdoc/en/reference/pdo/functions  PDO-query.xml 
  Log:
  Add an example to PDO::query.
  
  
http://cvs.php.net/diff.php/phpdoc/en/reference/pdo/functions/PDO-query.xml?r1=1.1&r2=1.2&ty=u
Index: phpdoc/en/reference/pdo/functions/PDO-query.xml
diff -u phpdoc/en/reference/pdo/functions/PDO-query.xml:1.1 
phpdoc/en/reference/pdo/functions/PDO-query.xml:1.2
--- phpdoc/en/reference/pdo/functions/PDO-query.xml:1.1 Mon Jan 17 22:16:39 2005
+++ phpdoc/en/reference/pdo/functions/PDO-query.xml     Thu Feb 10 20:31:12 2005
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="iso-8859-1"?>
-<!-- $Revision: 1.1 $ -->
+<!-- $Revision: 1.2 $ -->
 <!-- Generated by xml_proto.php v2.2. Found in /scripts directory of phpdoc. 
-->
 <refentry id="function.PDO-query">
  <refnamediv>
@@ -51,22 +51,26 @@
   </para>
  </refsect1>
 
- <!-- Use when examples exist
  <refsect1 role="examples">
   &reftitle.examples;
   <para>
    <example>
-    <title><function>A PDO-query example</title>
+    <title>Demonstrate PDO::query</title>
     <para>
-     Any text that describes the purpose of the example, or
-     what goes on in the example should go here (inside the
-     <example> tag, not out
+     A nice feature of <function>PDO::query</function> is that it
+     enables you to iterate over the rowset returned by a
+     successfully executed SELECT statement.
     </para>
     <programlisting role="php">
 <![CDATA[
 <?php
-if ($anexample === true) {
-    echo 'Use the PEAR Coding Standards';
+function getFruit($conn) {
+    $sql = 'SELECT name, colour, calories FROM fruit ORDER BY name';
+    foreach ($conn->query($sql) as $row) {
+        print $row['NAME'] . "\t";
+        print $row['COLOUR'] . "\t";
+        print $row['CALORIES'] . "\n";
+    }
 }
 ?>
 ]]>
@@ -74,13 +78,18 @@
     &example.outputs;
     <screen>
 <![CDATA[
-Use the PEAR Coding Standards
+apple   red     150
+banana  yellow  250
+kiwi    brown   75
+lemon   yellow  25
+orange  orange  300
+pear    green   150
+watermelon      pink    90
 ]]>
     </screen>
    </example>
   </para>
  </refsect1>
- -->
 
 
  <refsect1 role="seealso">

Reply via email to