如何在ajax调用期间输出或提醒mysqli错误消息?
这是我的PHP代码
if(isset($_POST['resumetitle']) || isset($_POST['name']) || isset($_POST['dob']) || isset($_POST['gender']) || isset($_POST['cvid'])){
$result = $db->updatepdetails($_POST['resumetitle'],$_POST['name'],$_POST['dob'],$_POST['gender'],$_POST['cvid']);
if($result){
echo "success!";
} else {
echo "failed! ".$result->error;
}
}
//这是我的js代码
$.ajax({
type: "POST",
url: "classes/ajax.resumeupdate.php",
data: "resumeid="+cvid+"&resumetitle="+resumetitle+"&name="+name+"&dob="+dob+"&gender="+gender,
success: function(msg){
//window.location = "resumeview.php?cvid="+cvid;
alert(msg);
},
});
在ajax调用之后,它只弹出“失败!”这个词。 ...我希望看到mysqli_error,那是怎么回事?
答案 0 :(得分:0)
您使用$db->error
而非$result->error