- Messages
- 1,682
- Reaction score
- 32
- Points
- 48
PHP:
function createChancePool($organizationID) {
$sql = "SELECT numChance FROM organizations WHERE id='$organizationID'";
$result = mysql_query($sql);
while($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
$numChances = $row['numChance'];
}
$table = "chancePool_$organizationID";
$sql = "DROP TABLE IF EXISTS `$table`";
mysql_query($sql);
$sql = "CREATE TABLE `$table` (
`chanceID` int(4) NOT NULL,
`active` tinyint(1) NOT NULL,
`member` int(7) NOT NULL,
PRIMARY KEY (`chanceID`)
)";
if(!mysql_query($sql)) {
mysql_query("DROP TABLE IF EXISTS `$table`");
return false;
}
$i = "0";
while ($i < $numChances) {
$sql = "INSERT INTO $table (chanceID, active, member) VALUES ('$i', '0', '0')";
if(!mysql_query($sql)) {
mysql_query("DROP TABLE IF EXISTS `$table`");
return false;
}
$i++;
}
$sql2 = "UPDATE organizations SET chancepool='1' WHERE id=$organizationID";
mysql_query($sql2);
return true;
}
I have it set so the max is 7 digits, which is more than 1million, so i need to fix that. but 1 million is the max
and I have the script running right now, and its so far taking 5 minutes and im up to: 437,311 rows
and it stops there.