diff options
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 |