Using Postman to see if this section of php works as intended, however Postman returns the error Malformed JSON: Unexpected 'U'
and the database is not updated, can't get my head around this error as it looks fine to me?
Code:
function placeVoteForCandidate()
{
global $connect;
$username = $_POST["username"];
$query = "UPDATE User SET votesAttained=votesAttained+1 WHERE USER_NAME = $username";
mysqli_query($connect, $query) or die (mysqli_error($connect));
mysqli_close($connect);
$message['success'] = 'Vote added';
echo json_encode($message);
}