Which is better approach "taxonomy_get_term" or using SQL to display term name on template file I have a View page with term id in its URL as argument and I have found two ways to display term names on Views template file.

One is using taxonomy_get_term(); the other one is querying the database.

$explode_vocubulary=explode("/",$_GET['q']);
$vocubulery1=$explode_vocubulary[1];
$sqlvoc1="SELECT *  FROM `term_data` WHERE `tid` =".$vocubulery1;
$rowvoc1=db_query($sqlvoc1);
while($resultvoc1=db_fetch_object($rowvoc1)) {  
  echo  $resultvoc1-&gt;name;
}


I'm not a coder and don't understand the difference very well but it seems that using Drupal API seems to be cleaner. What the difference between these two approaches or which is the better way?
Literally the only difference between you calling taxonomy_get_term() and running the query yourself is that taxonomy_get_term() statically caches and serves term objects that have been loaded previously in the same page load.

You'll only get performance increases, not decreases, if you use the API function so I'd thoroughly recommend using that instead of going directly into the database.

Since you're running an identical query anyway, it's just repetition of code otherwise.

This is the code from taxonomy_get_term(), it should help illustrate the above:

function taxonomy_get_term($tid, $reset = FALSE) {
  static $terms = array();

  if ($reset) {
    $terms = array();
  }

  if (!isset($terms[$tid])) {
    $terms[$tid] = db_fetch_object(db_query('SELECT * FROM {term_data} WHERE tid = %d', $tid));
  }

  return $terms[$tid];
}