title: Creating own API using Slim and stucked at one point
body: <p>Can anybody reply to me why the data i am getting are all null. This is what I am getting: </p>
  
  <pre><code>{ current_field: null field_count: null lengths: null num_rows: null type: null } 
  </code></pre>
  
  <p>I am working on an Android Project in which i am calling an api and showing the response data on the mobile device.</p>
  
  <p>I am stuck on this code below</p>
  
  <p>API Call</p>
  
  <pre><code>    $app-&gt;get('/sample',function() {
      $db = new DbHandler();
      $res = $db-&gt;getAll();
  
      echoRespnse(200, $res);
  });
  </code></pre>
  
  <p>Here I am returning all the records from table to the API and then returning back it to the mobile device from where it was called.</p>
  
  <pre><code>        public function getAll($data) {
          $stmt = $this-&gt;conn-&gt;prepare('select * from tab');
  
          $stmt-&gt;execute();
          $data = $stmt-&gt;get_result();
  
          $stmt-&gt;close();
          return $data;
      }
  </code></pre>