Can somebody help me port this php block snippet to make it work in V6.x.

http://drupal.org/node/135344

// comma separated lists of terms tid to display nodes
$terms = "49,50";

// the number of nodes to show
$count = 10;


$sql = "SELECT n.title, n.nid FROM {node} n INNER JOIN {term_node} tn ON n.nid = tn.nid WHERE tn.tid in ($terms) AND n.status=1 ORDER BY n.created DESC";
$result = db_query_range(db_rewrite_sql($sql), 0, $count);
if (db_num_rows($result)) {
  return node_title_list($result);
}
return t('No nodes available.');