title: Break command inside a while loop prevents second while loop from running
body: <p>In this code, the first while loop just checks if the number of posts with a $message field available are more than one. If it is, the variable $morethanonce is defined, and break should exit the loop because it is no longer needed. Then the second while loop should execute.</p>
  
  <p>But for some reason, the break in the first while loop is preventing the second while from running.</p>
  
  <p>Of course, I can just remove the break, which is not strictly necessary, and everything works fine, but I would like someone to explain to me why this is happening.</p>
  
  <pre><code>&lt;?php
  function availability_warning () {
      global $post;
      $closed_messages_query = new WP_Query;
      $closed_messages_query-&gt;query('post_type=ok_product&amp;showposts=50&amp;orderby=title&amp;order=ASC');
      $i = 0;
      while ($closed_messages_query-&gt;have_posts()) : $closed_messages_query-&gt;the_post();
          $message =  get_post_meta($post-&gt;ID, "ok_product_closed_message", true);    
          if ($message) {
              $i++;
              if ($i == 2){
                  $morethanone = "yes";
                  break;
              }
          }       
      endwhile;   
      $i = 0;
      while ($closed_messages_query-&gt;have_posts()) : $closed_messages_query-&gt;the_post();
          $message =  get_post_meta($post-&gt;ID, "ok_product_closed_message", true);    
          if ($message) { 
              $i++; 
              if ($i == 1) { 
                  if ($morethanone == 'yes'){ echo '&lt;div class="prod-warnings"&gt;&lt;ul id="warnings" class="morethanone"&gt;';}
                  else {echo '&lt;div class="prod-warnings"&gt;&lt;ul id="warnings"&gt;';}
              }
              echo '&lt;li&gt;'.$message.'&lt;/li&gt;'; 
          }                  
      endwhile;
      if ($i &gt; 0) { echo '&lt;/ul&gt;&lt;/div&gt;'; } 
  }
  
  ?&gt;
  </code></pre>