|
@@ -46,21 +46,20 @@ function update()
|
|
|
$query_count = min($params, 500);
|
|
|
}
|
|
|
|
|
|
- $statement = $pdo->prepare('SELECT randomNumber FROM World WHERE id=?');
|
|
|
- $updateStatement = $pdo->prepare('UPDATE World SET randomNumber=? WHERE id=?');
|
|
|
+ $statement = $pdo->prepare('SELECT randomNumber FROM World WHERE id=?');
|
|
|
+ $update = '';
|
|
|
|
|
|
while ($query_count--) {
|
|
|
$id = mt_rand(1, 10000);
|
|
|
$statement->execute([$id]);
|
|
|
|
|
|
$world = ['id' => $id, 'randomNumber' => $statement->fetchColumn()];
|
|
|
- $updateStatement->execute(
|
|
|
- [$world['randomNumber'] = mt_rand(1, 10000), $id]
|
|
|
- );
|
|
|
+ $world['randomNumber'] = mt_rand(1, 10000);
|
|
|
+ $update .= "UPDATE World SET randomNumber={$world['randomNumber']} WHERE id=$id;";
|
|
|
|
|
|
$arr[] = $world;
|
|
|
}
|
|
|
-
|
|
|
+ $pdo->exec($update);
|
|
|
echo json_encode($arr, JSON_NUMERIC_CHECK);
|
|
|
}
|
|
|
|