function DatabaseHandler::request_new_group_id
Search API
6.x DatabaseHandler.php | DatabaseHandler::request_new_group_id() |
File
- classes/
DatabaseHandler.php, line 356
Class
Code
function request_new_group_id()
{
// Return a valid new group_id...
for ($t = 0; $t < 1000; $t++)
{
$id = mt_rand(1, 2147483640); // A few less than the max for a signed int in mysql.
// 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;
}