taxonomy_get_parents
Definition
taxonomy_get_parents($tid, $key = 'tid')
modules/taxonomy.module, line 537
Description
Find all parents of a given term ID.
Code
<?php
function taxonomy_get_parents($tid, $key = 'tid') {
if ($tid) {
$result = db_query('SELECT t.* FROM {term_hierarchy} h, {term_data} t WHERE h.parent = t.tid AND h.tid = %d ORDER BY weight, name', $tid);
$parents = array();
while ($parent = db_fetch_object($result)) {
$parents[$parent->$key] = $parent;
}
return $parents;
}
else {
return array();
}
}
?> 