fork download
  1. <?php
  2. $sqlAdd = NULL;
  3. if (!empty($_POST)) {
  4. if (isset($_POST['task_add'])) {
  5. $task = $_POST['task_add'];
  6. $taskDate = date('D.M.Y')." ".date('H:i:s');
  7. $sqlAdd = "INSERT INTO tasks(id, description, is_done, date_added) VALUES (?,?,?,?)";
  8. }
  9. }
  10. $db = new PDO("mysql:host=localhost;dbname=mydb;charset=utf8",'mysql','mysql');
  11. if ($sqlAdd != NULL) {
  12. $dbh = $db->prepare($sqlAdd);
  13. $dbh->execute([NULL,$task,0,$taskDate]) or die ("Problems adding!");
  14. }
Runtime error #stdin #stdout #stderr 0.01s 82880KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
PHP Fatal error:  Uncaught PDOException: could not find driver in /home/nPTAL5/prog.php:10
Stack trace:
#0 /home/nPTAL5/prog.php(10): PDO->__construct('mysql:host=loca...', 'mysql', 'mysql')
#1 {main}
  thrown in /home/nPTAL5/prog.php on line 10