Guest User

Untitled

a guest
Oct 20th, 2018
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.37 KB | None | 0 0
  1. <?php
  2. $startTime = microtime(true);
  3.  
  4. mysql_connect('localhost', 'php', 'php');
  5. mysql_select_db('php_mysqltest');
  6. $q = mysql_query('SELECT * FROM test');
  7. $result = array();
  8. while($row = mysql_fetch_assoc($q)) {
  9. $result[] = $row;
  10. }
  11. header('Content-Type: application/json');
  12. echo json_encode($result);
  13.  
  14. $endTime = microtime(true);
  15. echo 'Query took ', $endTime - $startTime, ' seconds';
Add Comment
Please, Sign In to add comment