title: Query returns empty array
body: <p>I am trying to query some data from my database. I am trying to do <code>GET</code> and put them into array to output it as <code>JSON</code>. However it return empty array. My question is why since my database contains information and I know that my connections etc. are correct because I got working <code>POST</code>.</p>
  
  <p>I am using <strong>Slim Framework v3</strong> and for connection <code>PDO</code>.</p>
  
  <p>This is what I am trying to do:</p>
  
  <pre><code>$app-&gt;get('/users/get', function ($request, $response, $args) {
  require 'db.class.php';
  $database = new Database();
  $database-&gt;query("SELECT * FROM `workbungee`.`user`");
  $users = array();
  while ($row = mysql_fetch_assoc($database)) {
  
      $users[] = $row;
  }
      $struct = array("User" =&gt; $users);
      print json_encode($struct);
      return $response-&gt;write("Hello " . count($jobArray));
  
  });
  </code></pre>
  
  <p>This is what it returns:</p>
  
  <pre><code>{
    "User": []
  }
  </code></pre>
  
  <p>In db.class.php I have the following functions:</p>
  
  <pre><code>public function resultset(){
          $this-&gt;execute();
          return $this-&gt;stmt-&gt;fetchAll(PDO::FETCH_ASSOC);
      }
  
      public function single(){
          $this-&gt;execute();
          return $this-&gt;stmt-&gt;fetch(PDO::FETCH_ASSOC);
      }
  </code></pre>
  
  <p>If I try to echo inside while loop, I can't get any output but just status code: 200.</p>
  
  <p>I've tried so many other solutions and have read dozen of questions.</p>