这段代码中有错误吗,因为它正确输出了成功消息,但是数据库中没有任何更新

问题描述

下面是我的代码

$sql1 = "Update Exams set   
            Institution_Level=:level,ExamYear=:year,ExamTerm=:term,ClassName=:cls,Subject=:subj,ExamType=:etype,ExamAndAnswersPdf=:pdffile,ExamPreview=:epreview,ExamAndAnswersDoc=:docfile,Description=:des,Uploaded_On=:date,Price=:pr 
        where IdExam=:id";

$smt = $conn->prepare($sql1);
//execute the query
if ($smt->execute(['level' =>$lev,'year' =>$Eyear,'term' =>$term,'cls' =>$class,'subj' =>$subject,'etype' =>$type,'pdffile' =>$fileName,'epreview' =>$filePreview,'docfile' =>$fileworddoc,'des' =>$desc,'date'=>$date,'pr' =>$prc,'id' =>$exid])) 
{
    # code...
    $_SESSION['success'] = "Exam Edited SuccessFully";
    header("location:UploadExam.PHP");
    exit;
} else {
    $_SESSION['err'] = "Sorry!! Exam Could not be updated";
    header("location:UploadExam.PHP");
    exit;
}

预先感谢

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)