prepare("INSERT INTO books (title,author) VALUES (:title, :author)"); $query->execute(["title"=>$title,"author"=>$author]); $lastId = $pdo->lastInsertId(); header("Location: index.php?status=added&id=".$lastId); exit; } catch (PDOException $e) { $errors[]= "Chyba při ukládní do databáze:". html_escape($e->getMessage()); } } } ?>