Ya lo he solucionado !! Aqui lo dejo por si le sirve a alguien !
Código PHP:
function getCategoryList()
{
$sql = "SELECT p.cat_id, p.cat_id2, p.cat_id3, cat_name, cat_image, COUNT(p.cat_id) AS TOTAL
FROM tbl_category c, tbl_product p
WHERE c.cat_id = p.cat_id
GROUP BY cat_name";
$result = dbQuery($sql);
$cat = array();
while ($row = dbFetchAssoc($result)) {
extract($row);
if ($cat_image) {
$cat_image = WEB_ROOT . 'images/category/' . $cat_image;
} else {
$cat_image = WEB_ROOT . 'images/no-image-small.png';
}
$cat[] = array('url' => $_SERVER['PHP_SELF'] . '?c=' . $cat_id,
'image' => $cat_image,
'name' => $cat_name,
'id' => $TOTAL);
}
return $cat;
}
Gracias a ambos de todas formas