Invalid parameter number: number of bound variables does not match number of tokens

后端 未结 1 571
無奈伤痛
無奈伤痛 2020-12-07 06:14

I am getting this error message on an assignment for class. Ive created an UPDATE which uses forms for a user to edit the content being printed out from a database on the pr

相关标签:
1条回答
  • 2020-12-07 06:56

    You have five bound parameters but are only binding four values to them. You're missing your value for :videoId.

    $sql = "UPDATE videoinfo
            SET submitter = :submitter,
                videoTitle = :videoTitle,
                channelName = :channelName,
                videoLink = :videoLink
            WHERE videoId = :videoId";
    $stmt = $dataconn -> prepare($sql);
    $stmt -> execute( array(":submitter" => $_POST['submitter'],
                            ":videoTitle" => $_POST['videoTitle'],
                            ":channelName" => $_POST['channelName'],
                            ":videoLink" => $_POST['videoLink'],
                            ":videoId" => $_POST['videoId']
                            ) 
                    );
    
    0 讨论(0)
提交回复
热议问题