I have the following script currently, which gets the category IDs as arrays:
$sql_select_categories = $db->query("SELECT category_id FROM " . DB_PREFIX . "categories
WHERE parent_id='" . intval($src_details['parent_id']) . "'
ORDER BY order_id ASC, name ASC");
$additional_vars = set_filter_link($src_details, array('parent_id' => '', 'start' => ''), 'address');
while ($cat_details = $db->fetch_array($sql_select_categories))
{
$cat_array[$cat_details['category_id']]["name"]=$category_lang[$cat_details['category_id']];
}
if(is_array($cat_array)){
asort($cat_array);
foreach($cat_array as $key => $value){
$subcat_link = basename($_SERVER['PHP_SELF']) . '?parent_id=' . $key . $additional_vars;
$output .= '<tr> '.
' <td class="contentfont"> » <a href="' . $subcat_link . '">' . $category_lang[$key] . '</a></td> '.
'</tr> ';
}
}
return $output;
This works perfectly, except I need to extract 1 more variable from the database which is called 'count'. so the mySQL query will change from
SELECT category_id FROM
to
SELECT category_id, count FROM
So far so good, but how do I get it to then display each of the counts in the foreach? I need them displayed in the HTML after $category_lang[$key] as something like $count.
Any help is greatly appreciated! I'm really bad with arrays.