Advertisement
ecto

Untitled

Oct 10th, 2016
360
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.79 KB | None | 0 0
  1. <?php
  2. /**
  3.  * Created by PhpStorm.
  4.  * User: yoann
  5.  * Date: 10/10/16
  6.  * Time: 14:28
  7.  */
  8.  
  9. include('includes/db.php');
  10. include('includes/functions.php');
  11.  
  12. startTime("sql");
  13. if (!$result = $db->query($argv[1])) {
  14.     die('There was an error running the query [' . $db->error . "]");
  15. }
  16. echo 'TIME = ' . diffTimeToMs("sql", microtime(true));
  17. echo "\n";
  18. var_dump(mysqli_fetch_assoc($result));
  19. echo "\n";
  20.  
  21. startTime("sql");
  22. if (!$result = $db->query("SELECT `id_users` FROM test WHERE `deleted`=0 LIMIT 1000000")) {
  23.     die('There was an error running the query [' . $db->error . "]");
  24. }
  25. echo "\n";
  26. $start = 0;
  27. while ($row = $result->fetch_assoc()) {
  28.     $start += $row['id_users'];
  29. }
  30. echo 'TIME = ' . diffTimeToMs("sql", microtime(true));
  31. echo "\n";
  32. echo 'value = '.$start;
  33. echo "\n";
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement