I want to get my current article's category and parent category link into my page. I get the category via the following code:
$db = JFactory::getDbo();
$id = $item->core_catid;
$db->setQuery("SELECT cat.title FROM #__categories cat WHERE cat.id='$id'");
$category = $db->loadResult();
echo '<p>'.$category.'</p>';
But I do not manage to get the parent category anyway. I try this but get no results:
$db->setQuery("SELECT cat.title FROM #__categories cat WHERE cat.parent_id='$id'");