title: Issue with using mysqli statement as a function return
body: <p>This is my model function:</p>
  
  <pre><code>  public function getAllArticles(){
      $stmt = $this-&gt;mysqli-&gt;prepare("select * from articles where 1 = 1");
      $stmt-&gt;execute();
      $stmt-&gt;bind_result($id, $name, $title, $excerpt, $content, $created_at, $updated_at);
      return $stmt;
  }
  </code></pre>
  
  <p>I'm trying to return the mysqli statement as my function return to assign it as a function call value to a variable inside this function:</p>
  
  <pre><code> public function index(){
      $model = new IndexModel();
      $out = $model-&gt;getAllArticles();
      Template::render('index', THEME_FOLDER, ['results' =&gt; $out]);
  }
  </code></pre>
  
  <p>And this is the render function which tries to return the correct theme:</p>
  
  <pre><code> public static function render($theme, $base_folder = THEME_FOLDER, $var = null){
      $theme = str_replace('.php', '', $theme);
      if(!self::theme_exists($theme, $base_folder))
          die("Template {$theme}.php could not be found in the {$base_folder} Directory.");
      require_once ($base_folder . $theme . '.php');
  }
  </code></pre>
  
  <p>And this is index.php, where I try to loop over <code>$var['results']-&gt;fetch()</code> but O got this every time:</p>
  
  <pre><code>Notice: Undefined variable: name in C:\xampp\htdocs\wiche\theme\index.php on line 15
  </code></pre>
  
  <p>And this is index.php:</p>
  
  <pre><code>    &lt;?php
      $statement = $var['results'];
      while ($statement-&gt;fetch()){
          echo $name;
      }
  ?&gt;
  </code></pre>
  
  <p>PS: When I use $stmt->fetch() in IndexModel.php (<code>getAllArticles()</code>) I could get the proper results. but when I return $stmt as function call value, I could not use the returned mysqli statement with fetch() function:</p>
  
  <pre><code>    public function getAllArticles(){
      $stmt = $this-&gt;mysqli-&gt;prepare("select * from articles where 1 = 1");
      $stmt-&gt;execute();
      $stmt-&gt;bind_result($id, $name, $title, $excerpt, $content, $created_at, $updated_at);
      //return $stmt;
      while ($stmt-&gt;fetch()){
          echo $name;
      }
  }
  </code></pre>
  
  <p>Thanks in advance.</p>