Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- error_reporting(E_ALL);
- try {
- $pdo = new PDO('mysql:host=127.0.0.1;dbname=to_do_list', 'root', '');
- } catch (PDOException $e){
- echo $e->getMessage ();
- die('Could not connected');
- }
- $sql = "INSERT INTO tasks(id, user_id, title, description, created_at, updated_at, due_date) VALUES (
- :title
- :due_date )";
- $stmt = $pdo->prepare($sql);
- if (!$stmt) {
- echo "\nPDO::errorInfo():\n";
- print_r($pdo->errorInfo());
- }
- $stmt->bindParam(':title', $_POST['title'], PDO::PARAM_STR);
- $stmt->bindParam(':due_date', $_POST['due_date'], PDO::PARAM_STR);
- $stmt->execute();
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement