I would like to include the div class < div class="section group" > every 3rd iteration of the loop. The format of the div layout I'm working with is below.
<div class="section group">
<div class="col span_1_of_3">
echo 'text';
</div>
<div class="col span_1_of_3">
echo 'text';
</div>
<div class="col span_1_of_3">
echo 'text';
</div>
</div>
The loop
$i = 1;
$sql = "select * from customers ORDER by customers_name";
$result = mysql_query($sql);
$row = mysql_fetch_array($result);
echo "<div>";
// echo '<div class="section group">'; this line needs to appear every 3 iteration pattern of a loop, how do I intergrate into loop below?
while ($row = mysql_fetch_array($result)) {
if ($i == 1) {
echo "<div class="col span_1_of_3">";
}
echo "<a href=\"customers.php?cust_id=" . $row['cust_id'] . "\">$row[cust_name]</a>";
if ($i == 3) {
$i = 1;
echo "</div>";
}
else {
$i++;
}
}
echo "</div>";