I have this little bit of script that just runs a query, retrieves all the categories in a database, and then lists them one on top of the other.
if ($all_categories) {
foreach ($all_categories as $cid => $arr) {
$sidebar .= '<a href="index.php?action=sort&cid=' . $cid . '">' . $arr['name'] . ' (' . $arr['count'] . ')</a><br />';
}
}
} else {
$sidebar = 'There are no categories yet';
}
Basically, I need this code to loop through the first 10 results, then echo some HTML div and then pick back up off in the loop. I am however new and not sure how I would go about doing this. I was thinking of incorporating a counter but not sure if that would be the correct method.