title: How do I get looping result?
body: <p>How do I get looping result? See the comment can't get result in code.</p>
  
  <pre><code>public function get_data_by_7_days()
      {   
  
      $arr = array();
          for ($i=7;$i&gt;=0;$i--)
          {
              $run=0;
              $run=$run-$i;
  
              $username = $this-&gt;session-&gt;userdata('username');
              $arr     = $this-&gt;M_vodor-&gt;get_data_by_7_days($username,$run);
  
          }
          echo json_encode($arr); //cant get result 
  }
  </code></pre>
  
  <p>This is my model <strong>M_vodor.php</strong></p>
  
  <pre><code>public function get_data_by_7_days($username,$run)
  {
  
      return $this-&gt;db-&gt;query("
      SELECT
      DAYNAME(DATE_FORMAT(DATE_ADD(NOW(), INTERVAL $run DAY) ,'%Y-%m-%d')) AS date_checker,
      DATE_FORMAT(DATE_ADD(NOW(), INTERVAL $run DAY) ,'%d-%m-%Y') AS show_date")-&gt;result();} 
  </code></pre>