Below code doesn't work:
$connection = mysqli_connect("XXX", "XXX", "XXX", "XXX");
if (isset($_POST['answer'])) {
if (!mysqli_query($connection, "INSERT INTO `answers`(`questionId`, `dateAndTime`, `answer`) VALUES ({$_SESSION['id']},(SELECT now()),{$_POST['answer']})")) {
echo ("Error description: " . mysqli_error($connection));
}
}
Output: Error description: 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 '!)' at line 1
Could you tell me what is wrong?