When trying to update my database I get a SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ':summary, wentWell:wentWell, ' error. Would really appreciate some help since I have been trying to solve this problem for days now.
This is the code I use to update the database (journal.php):
public function updateJournal($array) {
$query = "UPDATE journal SET
summary:summary,
wentWell:wentWell,
doBetter:doBetter,
ideas:ideas,
mood:mood,
motivation:motivation,
concentration:concentration,
tranquility:tranquility,
physical:physical WHERE id=:journalId";
$stmt = $this -> connection -> prepare($query);
$stmt -> execute();
}
I use an array (updateJournal.php) to send the data to the updateJournal-Function (journal.php):
$checkJournal -> updateJournal([
"summary" => $summaryField,
"wentWell" => $wentWellField,
"doBetter" => $doBetterField,
"ideas" => $ideasField,
"mood" => $sliderValueMood,
"motivation" => $sliderValueMotivation,
"concentration" => $sliderValueConcentration,
"tranquility" => $sliderValueTranquility,
"physical" => $sliderValuePhysical,
"journalId" => $journalId
]);
This is my Database: