I have the following piece of code that returns a number of categories, along with a counter of items in each category. The problem is that it's not returned alphabetically. How can I force them to be output alphabetically? I think it has to be with "asort" or something but I can't seem to figure out how. I'd greatly appreciate any advice! :)
The array to be alphabetically sorted is:
$category_lang[$cat_details['category_id']]
The complete code:
while ($cat_details = $db->fetch_array($sql_select_categories))
{
$subcat_link = basename($_SERVER['PHP_SELF']) . '?parent_id=' .$cat_details['category_id'] . $additional_vars;
$categoryCounter = (COUNT_CATS == 1 && !empty($src_details['keywords_search'])) ? $cat_counter[$cat_details['category_id']] : $cat_details['items_counter'];
if ($categoryCounter > 0 || COUNT_CATS == 0) {
$output .= '<tr> ' .
' <td class="contentfont"><a href="' . $subcat_link . '">' . $category_lang[$cat_details['category_id']] . '</a> ' .
(($categoryCounter) ? '<span class="cnt">(' . $categoryCounter . ')</span>' : '') .
' </td> ' .
'</tr> ';
}
}