i want to display 3 data per row and n number of rows. someone help me to do this.
<div class="top-box">
<?php include("config.php");
$sub2_category_id = $_GET['sub2product_id'];
$sub2_category_name = $_GET['sub2product_name'];
echo '<h2 class="head">'.$sub2_category_name.'</h2>';
$sql = mysql_query("SELECT p.`product_id`, p.`brand_name`, p.`brand_path`, p.`sub2_category_id`, p.`sub_category_id`, p.`main_category_id`, p.`date`,ba.`brand_amount_id`, ba.`available_pack`, ba.`mrp_amount`, ba.`our_price`, ba.`product_id` FROM `product` p JOIN brand_amount ba ON ba.product_id=p.product_id WHERE p.sub2_category_id='$sub2_category_id' GROUP BY p.`brand_name`");
$num_rows = mysql_num_rows($sql);
while($row = mysql_fetch_array($sql))
{
?>
<div class="col_1_of_3 span_1_of_3">
<a href="single.html">
<div class="inner_content clearfix">
<div class="product_image">
<img src="web/<?php echo $row['brand_path']; ?>" alt=""/>
</div>
<div class="price">
<div class="cart-left">
<p class="title"><?php echo $row['brand_name']; ?></p>
<div class="price1">
<span class="reducedfrom">Rs. <?php echo $row['mrp_amount']; ?></span>
<span class="actual">Rs. <?php echo $row['our_price']; ?></span>
</div>
</div>
<div class="cart-right"> </div>
<div class="clear"></div>
</div>
</div>
</a>
</div>
<div class="clear"></div>
<?php } ?>
</div>