Guest User

pdo_select

a guest
Jun 19th, 2013
5
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.68 KB | None | 0 0
  1. <?php
  2. $mtime = explode(' ', microtime());
  3. $tstart = $mtime[1] + $mtime[0];
  4. //////////////////////////////////
  5.  
  6. try {
  7.     $dbh = new PDO('mysql:host=localhost;dbname=mysql', 'miha', 'qwerty');
  8. }
  9. catch(PDOException $e) {
  10.     echo $e->getMessage();
  11. }
  12.  
  13. for ($i = 0; $i < 1000; $i++)
  14. {
  15.     $sth = $dbh->prepare("SELECT * FROM help_relation WHERE help_keyword_id = :id");
  16.     $sth->bindParam(":id", $u);
  17.     $u = $i;
  18.     $sth->execute();
  19.     echo 'rowCount: '.$sth->rowCount().'<br>';
  20. }
  21.  
  22. //////////////////////////////////
  23. $mtime = explode(' ', microtime());
  24. $mtime = $mtime[1] + $mtime[0];
  25. echo '<br><br>Time: '.round((($mtime - $tstart) * 1000), 4).' мс<br>';
  26. ?>
Advertisement
Add Comment
Please, Sign In to add comment