I have a gallery in grid.
For eg: https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcSegNVXMSnTRzHETnAjZXCd6siwHQysMXc_jp1OyiSDie2_9jhsIg
Each row can cont max of 4 images.
I have written while loop.
i want to get the total count of images in each row
For eg: row1 -> 4 (images)
row2 -> 3 (images)
<!----------------------------------------------------------------------------->
<div class="main_bg">
<div class="top_bg1">
<div class="">
<div class="main">
<div class="top_main">
<h1>Today's Offer</h1>
<div class="clear"></div>
</div>
<?php
$query1 = mysql_query("select * from offer");
$x = 0;
while($row = mysql_fetch_array($query1)){
?>
<?php
if($x==0){
?>
<div class="grids_of_3">
<?php
}
?>
<!-- start grids_of_3 -->
<div class="grid1_of_3">
<a href="offer_details.php?fid=<?php echo $row['offer_id']; ?>">
<?php echo "<img src=admin/offer/".$row['image']." />"; ?>
<h4><?php echo $row['offer_title']; ?></h4>
<span class="price"><?php echo 'Rs: '.$row['price']; ?></span> <span class="price1 bg">Hot Sale</span>
</a>
<h3><a href="offer_details.php?fid=<?php echo $row['offer_id']; ?>" class="myButton">Add to cart</a></h3>
</div>
<?php
$x++;
echo $x;
if($x==4){
echo '<div class="clear"></div></div>';
$x=0;
}
} // while
?>
<!-- start grids_of_3 -->
</div>
</div>
</div>
</div>
<!----------------------------------------------------------------------------->
<!-- start footer -->
</div>
</div>