하여이 개 결과를 표시 나는 다음 foreach 문이 있습니다는 DIV
<?php
foreach($result15 as $row15) {
$thumb15 = $row15->thumb;
$id15 = $row15->id_discografia;
?>
<div class='wrapper'>
<div class="album"><img src="img/<?php echo $thumb15; ?>" alt="" width="246" height="246"></div>
</div>
<?php } ?>
을하지만, 따라서 각 사업부 .wrapper 내에서만 사업부의 .album 나타납니다. 각 div. 래퍼 내에서 두 divs. 앨범을 어떻게 볼 수 있습니까? 이 같은
<?php
$total = 0;
foreach($result15 as $row15){
$thumb15 = $row15->thumb;
$id15 = $row15->id_discografia;
if($total == 0){
echo '<div class="wrapper">';
}
?>
<div class="album" data-disco="disco<?php echo $id15; ?>">
<img src="img/<?php echo $thumb15; ?>" alt="" width="246" height="246">
</div>
<?php
$total = $total + 1;
if($total % 2 == 0){
echo '</div>';
$total = 0;
}
}
?>
foreach 루프 내에서 echo를 사용해보십시오. – blackuprise
@blackuprise I beleive 카운터가 필요합니다. 그러나 나는 그것을 사용하는 방법을 모른다 – user2433958