title: Multiple rows with PHP foreach?
body: <p>I am trying to make a table with 4 rows from a foreach-call.</p>
  
  <p>My problem is, that in the result I get each ID twenty times in the same column.</p>
  
  <p>I'm using this code:</p>
  
  <pre><code>&lt;table  width="80%" border="0" cellpadding="10px"&gt;
  
     &lt;?php foreach (array_chunk($items, 4) as $row) { ?&gt;
  
        &lt;?php     
           $i = 0;    
              foreach ($items as $item):      
              $class = null;      
              if ($i++ % 2 == 0) {            
              $class = ' class="altrow"';         
        } ?&gt;
  
       &lt;tr
          &lt;?php echo $class;?&gt;
       &gt;  
  
    &lt;?php foreach ($row as $item){ ?&gt;         
       &lt;td&gt;
          &lt;?php echo htmlentities ($item['Item']['id']); ?&gt;
       &lt;/td&gt;
    &lt;?php } ?&gt; 
  &lt;?php endforeach; ?&gt;    
  &lt;/tr&gt; 
  &lt;?php } ?&gt; 
  &lt;/table&gt;
  </code></pre>
  
  <p><strong>Any idea how I could get each ID just once?</strong></p>