title: PHP Prepared Statement Foreach Loop
body: <p>The code below only returns one result. The remaining five results are blank. How can I return all rows?</p>
  
  <pre><code>foreach($dates as $date){
  
      if($stmt-&gt;prepare("SELECT event FROM calendar WHERE date = ?")) {
  
          $stmt-&gt;bind_param('i',$date);
  
          $stmt-&gt;execute();
  
          $stmt-&gt;bind_result($event);
  
          $stmt-&gt;store_result();
  
          while($stmt-&gt;fetch()) {
              echo $event;
          }
          $stmt-&gt;close();
      }
  }
  </code></pre>