title: CodeIgniter continuing a foreach loop after another one has been run through
body: <p>I have 2 separate foreach loops being executed in the following code. At the end I have $row->websiteURL outputting right after the second foreach loop. The problem is $row->websiteURL is part of the first loop. So I get the following error when I run the code:</p>
  
  <blockquote>
    <p>A PHP Error was encountered</p>
    
    <p>Severity: Notice</p>
    
    <p>Message: Undefined property: stdClass::$websiteURL</p>
    
    <p>Filename: views/projects.php</p>
    
    <p>Line Number: 135</p>
    
    <p>" target="_blank"></p>
  </blockquote>
  
  <p>How would I go about continuing the first foreach loop after the second foreach is complete?</p>
  
  <pre><code>&lt;table style="width: 41%"&gt;
  &lt;?php   $query  = $this-&gt;db-&gt;query("SELECT * FROM projects ORDER BY idprojects DESC");
          foreach ($query-&gt;result() as $row) { ?&gt;
      &lt;tr&gt;
          &lt;td style="height: 15px"&gt;
          &lt;div class="auto-style2"&gt;
              &lt;em&gt;&lt;span class="auto-style1"&gt;&lt;?=$row-&gt;projectName?&gt;&lt;/span&gt;&lt;/div&gt;
          &lt;table cellpadding="5" style="width: 535px; height: 66;"&gt;
              &lt;tr&gt;
                  &lt;td class="box1" style="height: 49px; width: 800px;"&gt;
          &lt;table cellpadding="0" cellspacing="0" style="width: 466px; height: 185px"&gt;
              &lt;!-- MSTableType="layout" --&gt;
              &lt;tr&gt;
                  &lt;td valign="top" style="width: 225px"&gt;
              &lt;em&gt;
          &lt;table style="width: 100%"&gt;
              &lt;tr class="box1"&gt;
                  &lt;td class="innerbox" style="height: 88px"&gt;&lt;em&gt;&lt;span class="text1"&gt;Project name&lt;/span&gt;:
                  &lt;span class="underlined-link"&gt;&lt;?=$row-&gt;projectName?&gt;&lt;/span&gt;&lt;br&gt;
                  &lt;span class="text1"&gt;Description&lt;/span&gt;: &lt;?=$row-&gt;projectDesc?&gt;&lt;br&gt;&lt;span class="text1"&gt;Start 
                  date&lt;/span&gt;: &lt;?=$row-&gt;startDate?&gt;&lt;br&gt;&lt;span class="text1"&gt;Finised date&lt;/span&gt;: 
                  &lt;?=$row-&gt;finishedDate?&gt;&lt;br&gt;&lt;span class="text1"&gt;Created for&lt;/span&gt;: 
                  &lt;?=$row-&gt;createdFor?&gt;&lt;br&gt;&lt;span class="text1"&gt;Contributers&lt;/span&gt;:
                  &lt;span class="underlined-link"&gt;&lt;?=$row-&gt;contributors?&gt;&lt;/span&gt;&lt;/em&gt;&lt;/td&gt;
              &lt;/tr&gt;
          &lt;/table&gt;
          &lt;/em&gt;&lt;/td&gt;
                  &lt;td style="width: 12px"&gt;&amp;nbsp;&lt;/td&gt;
                  &lt;td valign="top" style="height: 185px; width: 229px"&gt;
              &lt;em&gt;
  &lt;?php           $query  = $this-&gt;db-&gt;query("SELECT * FROM screenshots ORDER BY idscreenshot DESC");
                  foreach ($query-&gt;result() as $row) { ?&gt;
                  &lt;img alt="" src="&lt;?=$row-&gt;screenshotURI?&gt;" width="231" height="187"&gt;&lt;/em&gt;&amp;nbsp;&lt;/td&gt;
              &lt;/tr&gt;
  &lt;?php } ?&gt;
          &lt;/table&gt;
                  &lt;br&gt;
                  &lt;a style="text-decoration:none" href="&lt;?=$row-&gt;websiteURL?&gt;" target="_blank"&gt;&lt;div class="link1"&gt;
                      View This Product&lt;/div&gt;&lt;/a&gt;
                  &lt;/td&gt;
              &lt;/tr&gt;
          &lt;/table&gt;
          &lt;/em&gt;&lt;/td&gt;
      &lt;/tr&gt;
  &lt;?php } ?&gt;
          &lt;/table&gt;
  </code></pre>