Alprod Grm
Alprod Grm

Reputation: 53

Fatal error: Uncaught PDOException: SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax

Hello everyone I try to update to boolean in my table, so I had Error PDOException and I don't Why :

Fatal error: Uncaught PDOException: SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax

My line code sql is this :

public function updateSignal(Comments $comment)
{
    $req = 'UPDATE Comments SET signal = TRUE WHERE idComments = :comment';
    $result = $this->getBdd()->prepare($req);
    $result->bindValue(':comment', $comment->getIdComments());

    return $result->execute();
}

I don't find where is my error syntax, Please need help Thanks

Upvotes: 0

Views: 610

Answers (1)

SIGNAL is a reserved word. It's best to avoid it, but you can use it if you wrap it in backticks.

$req = 'UPDATE Comments SET `signal` = TRUE WHERE idComments = :comment';

(MySQL reserved words)

Upvotes: 1

Related Questions