insert html between mysql records
Posted: Thu Apr 15, 2010 10:33 am
Hi, I am wondering if it is possible to add code after x amount of records in my while loop from mysql. I want to be able to insert a div that clears floats after 3 records. So for example:
So each of my div's are floating to the left. Each record is stored in a div. I would like to insert a div that clears the floats for a new line of div's. I hope this makes sense. COuld someone show me how this could be done, if it can be done. Thank you
Rob
Code: Select all
<?php $query_classifieds = mysql_query("SELECT id, categoryName, permalink, is_active FROM classified_categories WHERE is_active = '1' && parentId = '$parentId' ORDER BY categoryName ASC");
while ($row_classcat = mysql_fetch_array($query_classifieds)) { ?>
<div class="classified-categoryBox">
<h2 class="subcategory"><a href="./<?php echo $row_parent['permalink']; ?>/<?php echo $row_classcat['permalink']; ?>.html" title="<?php echo $row_classcat['categoryName']; ?> classified ads"><?php echo $row_classcat['categoryName']; ?></a></h2>
<?php
$id = $row_classcat['id'];
$catcount = mysql_query("SELECT id FROM classifieds WHERE categoryid = '$id'");
$totalads = mysql_num_rows($catcount);
?>
<p>Current number of ads: <?php echo $totalads; ?></p>
</div><!--end classified ad box-->
<?php } ?>Rob