Error when trying to execute insert into mysql datebase

Viewed 29

I'm completely slumped here

Error:

Fatal error: Uncaught PDOException: SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '' at line 2 in C:\xampp\htdocs\admin\assets\page_includes\connection.php:26 Stack trace: #0 C:\xampp\htdocs\admin\assets\page_includes\connection.php(26): PDOStatement->execute() #1 C:\xampp\htdocs\admin\create.php(4): Connection->addNote(Array) #2 {main} thrown in C:\xampp\htdocs\admin\assets\page_includes\connection.php on line 26

The error is stemming from the return $statement->execute();

here:

public function addNote($note)
    {
        $statement = $this->pdo->prepare("INSERT INTO notes (title, description, create_date)
                                            VALUES (:title, :description, :date");
        $statement->bindValue('title', $note['title']);
        $statement->bindValue('description', $note['description']);
        $statement->bindValue('date', date('Y-m-d H:i:s'));
        return $statement->execute();
    }

and its erroring on my create.php file

which is this code:

$connection = require_once 'assets/page_includes/connection.php';
$connection->addNote($_POST);

header('Location: Test.php');

i have no idea what it could be, any ideas?

0 Answers
Related