title: fetch() not returning first row
body: <p>I am trying to update code that has been written using prepared statements.  This is my first time using them and I am having difficulty retrieving all the results.  When I use a direct SQL statement, it works so I don't think that's the problem.</p>
  
  <p>The code will not return any results until there are at least two that match the query, then it will return all but the first row. I tried using fetchAll, but that gives different error about a call to an undefined method.</p>
  
  <p>Thanks in advance for any help that you can provide.  If it's not to much to ask, please provide example or reference I can refer to and complete my understanding.</p>
  
  <pre><code>function html_competitive_make_gallery ($init) {
  global $USER;
      $user_id     = $USER-&gt;id;
      $page_name = 'competitive';
      $base_name = $init['base_name'];
  
      global $link;
       $sql_pre = "SELECT form_id, community_id FROM frm_root WHERE user_id = ? 
  AND page_name = ? ORDER BY last_modified_date DESC LIMIT 1";
       $stmt = $link-&gt;prepare($sql_pre);
       $stmt-&gt;bind_param('is', $user_id, $page_name);
       $stmt-&gt;execute();
       $stmt-&gt;bind_result($form_id,$community_id);
       $stmt-&gt;fetch();
       $stmt-&gt;close();
  $sql = "SELECT data FROM tester WHERE type= '".$base_name."' 
  AND form_id= '".$form_id ."' AND community_id= '". $community_id ."' LIMIT 5";
  $stmt = $link-&gt;prepare($sql);
  $stmt-&gt;execute();
  $stmt-&gt;bind_result($data);
  $stmt-&gt;fetch();
  
  $html[]='&lt;div class="gallery" style ="width:100%;height:30%;overflow:hidden;"&gt;';
  
  
  while ($stmt-&gt;fetch()){
  
                     echo $data;
  
                  }
  $stmt-&gt;close();
  
  $html[]='&lt;/div&gt;';
  
  return implode ( $html);
  }
  </code></pre>