function DatabaseHandler::get_group_name

7.x DatabaseHandler.php DatabaseHandler::get_group_name($group_id)
6.x DatabaseHandler.php DatabaseHandler::get_group_name($group_id)

Returns the group_id for the given group name, or FALSE

File

classes/DatabaseHandler.php, line 879

Class

DatabaseHandler

Code

function get_group_name($group_id) {
  $temp = explode("_", $group_id);
  $group_id = trim(@$temp [0]);


  // If it's already in our static cache, just return that.
  static $group_name_cache = array();
  if (isset($group_name_cache [$group_id])) {
    return $group_name_cache [$group_id];
  }





  $res7 = $this->db_query("SELECT group_name FROM `groups`
              WHERE group_id = ?
              AND delete_flag = 0
               LIMIT 1 ", $group_id);
  if ($this->db_num_rows($res7) > 0) 
   {
    $cur7 = $this->db_fetch_array($res7);

    // Save to our cache before returning.
    $group_name_cache [$group_id] = $cur7 ['group_name'];
    return $cur7 ['group_name'];
  }
  return FALSE;


}