title: Echo content inside foreach only once
body: <p>I'm trying to echo content inside a foreach once. At the moment, when a form is filled by the user, the message is displayed for every record skipped. If there are 35 records skipped, I will get 35 messages, because of the foreach. I want to avoid this, and be able to display only one echo for the entire results page. How can I do this? I suppose I may have to do this outside the foreach, but I have no clue how to take it out of the foreach.</p>
  
  <pre><code>foreach($allcourses as $course)
  {
      if(Auth::LoggedIn())
      {
         if(Auth::$userinfo-&gt;rank == 'Student')
         {
             if($course-&gt;aircraft == '1')
             {
                 echo '&lt;div class="msg-red"&gt;Some lessons could not be found, because you may not be entitled to view/book them at this stage of your course.&lt;/div&gt;&lt;br/&gt;';
                 continue; 
             }
             if($course-&gt;aircraft == '2')
             {
                 echo '&lt;div class="msg-red"&gt;Some lessons could not be found, because you may not be entitled to view/book them at this stage of your course.&lt;/div&gt;&lt;br/&gt;';
                 continue; 
             }
          }
      }
  }
  </code></pre>