PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
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:
<?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 } ?>
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
Last edited by Benjamin on Thu Apr 15, 2010 11:55 am, edited 1 time in total.
Reason:Added [syntax=php] tags.