I’m getting this error when I run this code.
Parse error: syntax error, unexpected 'users_kudos_to_posts' (T_STRING)
The code.
if ($number > 0) {
$arr=explode(",",`$upvoted);
//If I comment out everything below I still get the error. But if I comment out
//the above code, then the error goes away.
if (in_array($primary_id, $arr)) {
array_push($arr, $primary_id);
$new_string = implode(",", $arr);
//the line below is where the parse error is pointing too.
if ($stmt2 = $mysqli->prepare("UPDATE `users_kudos_to_posts` SET `upvoted` = ?
WHERE `user_id` = ?")) {
$stmt2->bind_param('si', $new_string, $session_user_id);
$stmt2->execute();
$stmt2->close();
}
}
}
What’s crazy is that I have other multiple prepared statements in the same page of code with the same sql statement except for a change in columns and they work yet this doesn’t.
Also, I ran the sql statement in phpmyAdmin and it works.
Problem is this line:
You have an extra backtick that doesn’t belong there. It should be: