dbraw.php 483 B

12345678910111213141516171819202122232425
  1. <?php
  2. function db()
  3. {
  4. global $statement;
  5. $statement->execute([mt_rand(1, 10000)]);
  6. return json_encode($statement->fetch(), JSON_NUMERIC_CHECK);
  7. }
  8. function query()
  9. {
  10. global $statement;
  11. $query_count = 1;
  12. if ($_GET['q'] > 1) {
  13. $query_count = min($_GET['q'], 500);
  14. }
  15. while ($query_count--) {
  16. $statement->execute([mt_rand(1, 10000)]);
  17. $arr[] = $statement->fetch();
  18. }
  19. return json_encode($arr, JSON_NUMERIC_CHECK);
  20. }