title: PHP OOP: How to get database values and return all of them
body: <p>I am trying to get all the results from the database and return them to the screen, the problem is once i "echo" the value's they all show up, but when I use "return" only 1 shows up.</p>
  
  <p>I can't use echo because my application is build on a way it puts html into functions so i can fill objects and then fill the content of my page.</p>
  
  <p>Here is my code. </p>
  
  <pre><code>public function read() {
      $query = "SELECT id, title, description, datetime FROM seminar";
      $result = $this-&gt;getDb()-&gt;query($query);
  
      while(($row = $result-&gt;fetchObject()) !== false) {
          foreach($row as $value) {
          return $row-&gt;title;
          //$this-&gt;setDescription($row-&gt;description);
          //$this-&gt;setDatetime($row-&gt;datetime);
          }
      } 
  }
  </code></pre>
  
  <p>Now I am wondering how to get all value's on the screen instead of just the one it is showing now.</p>
  
  <pre><code>public function setSeminar($sem_obj) {
      $this-&gt;sem_obj = $sem_obj;
  }
  
  public function render() {
      $this-&gt;content = '
          On this page you can see all items.
      ';
      $this-&gt;content .= $this-&gt;sem_obj-&gt;getTitle();
      $this-&gt;content .= $this-&gt;sem_obj-&gt;getDescription();
      $this-&gt;content .= $this-&gt;sem_obj-&gt;getDatetime();
      //$this-&gt;content .= $this-&gt;text1-&gt;showSeminairs();
      return $this-&gt;content;
  }
  </code></pre>