fork download
  1. <?php
  2.  
  3.  
  4. $name = $_POST['name'];
  5. $db = new PDO("mysql:host = localhost;dbname = test", "root", "");
  6. $sth = $db->prepare("INSERT into foo SET ( name = $name )");
  7. $sth->bindParam(':name', $name);
  8. $sth->execute();
  9.  
  10. ?>
Runtime error #stdin #stdout #stderr 0.01s 20520KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
PHP Notice:  Undefined index: name in /home/Uc5Ur7/prog.php on line 6
PHP Fatal error:  Uncaught exception 'PDOException' with message 'could not find driver' in /home/Uc5Ur7/prog.php:7
Stack trace:
#0 /home/Uc5Ur7/prog.php(7): PDO->__construct('mysql:host = lo...', 'root', '')
#1 {main}
  thrown in /home/Uc5Ur7/prog.php on line 7