diff options
author | Evgeny Zinoviev <me@ch1p.io> | 2021-02-26 03:40:02 +0300 |
---|---|---|
committer | Evgeny Zinoviev <me@ch1p.io> | 2021-02-26 03:40:02 +0300 |
commit | ada8a13ce8a3410f4260601d213404bff5fa1cc7 (patch) | |
tree | a3ae5a714cf1fc5ebe5ce76175746b4b0c8a7abe /example/create-tasks.php |
initial
Diffstat (limited to 'example/create-tasks.php')
-rw-r--r-- | example/create-tasks.php | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/example/create-tasks.php b/example/create-tasks.php new file mode 100644 index 0000000..35968a9 --- /dev/null +++ b/example/create-tasks.php @@ -0,0 +1,17 @@ +<?php + +$db = new mysqli(); +if (!$db->real_connect('10.211.55.6', 'jobd', 'password', 'jobd')) + die('Failed to connect.'); + +$target = 'server1'; +$slots = ['low', 'normal', 'high']; + +for ($i = 0; $i < 100; $i++) { + $slot = $slots[array_rand($slots)]; + $time = time(); + if (!$db->query("INSERT INTO jobs (target, slot, time_created, status) VALUES ('$target', '$slot', $time, 'waiting')")) + echo "{$db->error}\n"; +} + +$db->close();
\ No newline at end of file |