微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

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

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

下面是我的代码

$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 举报,一经查实,本站将立刻删除。