title: PHP: display data retrieved from database (Silverstripe CMS)
body: <p>I have a problem using Silverstripe CMS.
  I have basic SQL query of which results I would like to display in <code>&lt;ul&gt;&lt;li&gt;</code> menu. It should be really easy but I failed while browsing documentation. I found some more complex examples (Project, Students), but it seems to me that should exists some easier way to do this. Can anyone help or please give me a hint?</p>
  
  <p>To sum up: I would like to run a db sql query and display data as list.</p>
  
  <p>My <strong>WishPage.php</strong></p>
  
  <pre><code>class WishPage extends Page {
      // some code which is irrelevant for this matter, but works fine
  }
  
  class WishPage_Controller extends Page_Controller {
  
      private static $allowed_actions = array('AddNewWishForm');
  
      public function AddNewWishForm() {
          // here you can add data to db
      }
  
      // Now I would like to show it; and here is the problem.
      public function ShowWishList() {
      $records = DB::query ("SELECT Title FROM Wishes;");
      return $records;
      }
  
  }
  </code></pre>
  
  <p>My template <strong>WishPage.ss</strong></p>
  
  <pre><code>&lt;% include SideBar %&gt;
  &lt;div class="content-container unit size3of4 lastUnit"&gt;
  
  &lt;div id="WishForm"&gt;
      &lt;h2&gt;Try it&lt;/h2&gt;
      $AddNewWishForm
  &lt;/div&gt;
  
  &lt;/div&gt;
  </code></pre>
  
  <p>Update<br/>
  My <strong>Wishes.php</strong></p>
  
  <pre><code>&lt;?php
  class Wishes extends DataObject {
      private static $db = array(
          'Name' =&gt; 'Text',
          'Comment' =&gt; 'Text'
      );
  }
  </code></pre>