fork download
  1. <?php
  2.  
  3. function pdo() {
  4. $stmt = $pdo->prepare('SELECT * FROM employees WHERE name = :name');
  5. $stmt->execute(array('name' => $name));
  6. foreach ($stmt as $row) {
  7. // do something with $row
  8. }
  9. }
  10. function mysqli() {
  11. $stmt = $dbConnection->prepare('SELECT * FROM employees WHERE name = ?');
  12. $stmt->bind_param('s', $name);
  13. $stmt->execute();
  14. $result = $stmt->get_result();
  15. while ($row = $result->fetch_assoc()) {
  16. // do something with $row
  17. }
  18. }
Success #stdin #stdout 0.03s 52480KB
stdin
Standard input is empty
stdout
Standard output is empty