How to add row with 5 values in a loop?

How to add row with 5 values in a loop?
<?php foreach($series as $row): ?> <div class="span2"> <a href="/series/get/<?php echo $row->id; ?>"><img src="/uploads/posters/<?php echo $row->poster; ?>"></a> </div> <?php endforeach; ?>
Ie displaying 5 images, then create a new
<div class="row">
 <div class="span2">
 <a href="/series/get/<?php echo $row->id; ?>"><img src="/uploads/posters/<?php echo $row->poster; ?>"></a>
</div>
</div>
July 9th 19 at 13:31
1 answer
July 9th 19 at 13:33
So?

<?php foreach($series as $row): ?>
<div class="row">
 <div class="span2">
 <a href="/series/get/<?php echo $row->id; ?>"><img src="/uploads/posters/<?php echo $row->poster; ?>"></a>
</div>
</div>
<?php endforeach; ?>
No, I'm blunted. The decision
<?php
$i = 0;
echo '<div class="row"-->';
foreach($series as $value):
?>
<div class="span2">
 <a href="/series/get/<?php echo $value->id; ?>"><img src="/uploads/posters/<?php echo $value->poster; ?>"></a>
</div>
<?php
$i++;
if($i == 5){
 echo '</div--><div class="row">';
}
endforeach;
echo '</div>';
?>
- Laury.Ritchie commented on July 9th 19 at 13:36

Find more questions by tags HTMLMySQLPHP