title: PDO Object empty
body: <p>This is my code:</p>
  
  <pre><code>class DB {
  static $instance;
  
  function get() {
      if (self::$instance === null) {
          self::$instance = new PDO('mysql:host=localhost;dbname=forum', 'root', 'root');
      }
      return self::$instance;
  }
  
  function getAllUsers() {
      $users = array();
      $sql = "SELECT * FROM users";
      foreach (self::get()-&gt;query($sql) as $row) {
          $users[] = new User($row);
      }
      return $users;    
  }
  }
  </code></pre>
  
  <p>And now I'm calling the getAllUsers function in here:</p>
  
  <pre><code>class App {
  function showUsers() {
      $users = DB::getAllUsers();
  }
  </code></pre>
  
  <p>Except its giving me an error: </p>
  
  <blockquote>
    <p>Warning: Invalid argument supplied for foreach()</p>
  </blockquote>
  
  <p>When I'm doing <code>var_dump</code> on <code>self::get</code> im getting a <code>bool(false)</code></p>
  
  <p>Can someone tell me what I'm doing wrong?</p>