Searching on SO for a quick solution to this. I am trying create a loop break after 5 items for example. PHP is not my strongest subject and the developer has left no comments.
The code should output this block, and loop. So there is a loop for the first LI and then a block loop for the 5 items inside it. I can't figure it out.
<li class="royalSlide">
<a href=""><img src="" /></a>
<a href=""><img src="" /></a>
<a href=""><img src="" /></a>
<a href=""><img src="" /></a>
<a href=""><img src="" /></a>
</li>
The code I have edited so far, I added the integer.
$i=5;
while($row = mysql_fetch_array($result))
{
$pid=$row["stock_products_code"];
$dir = "assets/sale/".$pid."/";$dh = opendir($dir);
echo '<li class="royalSlide">';
while (($file = readdir($dh)) !== false)
{
$vpxd=$file;
if($vpxd=="." || $vpxd=="..")
{
}else{
$vpxd=str_replace(".jpg","", $vpxd);
echo '<a href="/product-sale.php?prodref='.$vpxd.'" target="_top"><img src="/assets/sale/'.$pid.'/'.$file.'" border="0" /></a>';
$i++;
}
}
echo '</li>';
closedir($dh);
}