function _DatabaseHandler::request_new_group_id

4.x _DatabaseHandler.php _DatabaseHandler::request_new_group_id()
5.x _DatabaseHandler.php _DatabaseHandler::request_new_group_id()

File

classes/_DatabaseHandler.php, line 635

Class

_DatabaseHandler

Code

function request_new_group_id() 
 {
  // Return a valid new group_id...

  for ($t = 0; $t < 100; $t++) 
   {
    $id = mt_rand(1, 9999999);
    // Check for collisions...
    $res4 = $this->db_query("SELECT * FROM draft_group_requirements
              WHERE group_id = '$id' LIMIT 1");
    if ($this->db_num_rows($res4) == 0) 
     { // Was not in the table already, so use it!
      return $id;
    }
  }

  return false;

}