I need to get an associated array of terms in drupal that has node associated with it. However, I can't seem to figure it out the appropriate algorithm.
What I want is something like开发者_运维百科 taxonomy_get_tree(). But, only term that has associated node with it.
This query will get the term ids for you.
db_query("SELECT DISTINCT tid FROM {term_node}");
The following code should do exactly what you're after.
$terms = array();
$result = db_query("SELECT * FROM {term_data} WHERE tid IN (SELECT DISTINCT(tid) FROM {term_node})");
while($term = db_fetch_object($result)) {
  $terms[] = $term;
}
 
         
                                         
                                         
                                         
                                        ![Interactive visualization of a graph in python [closed]](https://www.devze.com/res/2023/04-10/09/92d32fe8c0d22fb96bd6f6e8b7d1f457.gif) 
                                         
                                         
                                         
                                         加载中,请稍侯......
 加载中,请稍侯......
      
精彩评论