title: OOP PDO fetch while loop
body: <p>I have a function in my class which is not completed. I'm searching a way to do it all night long. Well I want to fetch all the result of a SELECT request to MYSQL using PDO in a OOP class/function.</p>
  
  <p>Here my function</p>
  
  <pre><code>function select($query)
  {
      try
      {
      $sql = $this-&gt;connect-&gt;query($query);
          while ($row = $sql-&gt;fetch(PDO::FETCH_ASSOC))
          {
          return ????
          }
      }
      catch(PDOException $e) 
      {  
          echo $e-&gt;getMessage(); 
      }
  
  }
  </code></pre>
  
  <p>I know that I can do it with a while loop, I tested a few options but most of the time I only got 1 result. Anyone a point for me, where I could start my search for a solution to this issue?</p>