dbraw.php 584 B

123456789101112131415161718192021222324
  1. <?php
  2. function dbraw()
  3. {
  4. global $statement;
  5. //$statement = $pdo->prepare('SELECT id,randomNumber FROM World WHERE id=?');
  6. if ( ! isset($_GET['queries'])) {
  7. $statement->execute([mt_rand(1, 10000)]);
  8. return json_encode($statement->fetch(), JSON_NUMERIC_CHECK);
  9. }
  10. $query_count = 1;
  11. if ($_GET['queries'] > 1) {
  12. $query_count = min($_GET['queries'], 500);
  13. }
  14. while ($query_count--) {
  15. $statement->execute([mt_rand(1, 10000)]);
  16. $arr[] = $statement->fetch();
  17. }
  18. return json_encode($arr, JSON_NUMERIC_CHECK);
  19. }