解析错误:语法错误,意外'}'

时间:2016-02-18 05:09:59

标签: php compiler-errors

 <?php

    if(isset($_POST['poll'], $_POST['choice'])) 


{

    $poll = $_POST['poll'];

    $choice = $_POST['choice'];

    $voteQuery = $db->prepare("

        INSERT INTO polls_answers (user,poll, choice)
        SELECT :user, :poll, :choice
        FROM polls
        WHERE EXISTS (
        SELECT id
        FROM polls
        WHERE id = :poll



        ");
    $voteQuery->execute([
        'user' => $_SESSION['user_id'],
        'poll' => $poll,
        'choice' => $choice
        ]);
    header('Location:poll.php?poll='.$poll)
}

header('Location:plz.php');

?>

本程序给出了最后一个括号的错误。我不知道代码有什么问题,一切都在一起。

  

解析错误:语法错误,意外'}'

感谢您的帮助

2 个答案:

答案 0 :(得分:3)

请添加header('Location:poll.php?poll='.$poll);

{{1}}

答案 1 :(得分:1)

您在第30行缺少分号;

header('Location:poll.php?poll='.$poll);