如果otp错误,我想发送otp,而不是显示消息“未成功验证OTP”,还显示“成功OTP验证”。但按摩不能显示otp是否为curect而不是更新,否则无法更新。 请帮助...。
javaScript / Ajax
function otp_mobile_verify() {
var verify_otp_number = $("#verify_otp_number").val();
if (verify_otp_number) {
$.ajax({
url: "<?php echo base_url() ?>otp_mobile_verify_code",
data: "verify_otp_number=" + verify_otp_number,
type: "post",
success: function(response) {
$('#msg1').html(response);
}
});
}
}
欢迎控制器
public function otp_mobile_verify_code()
{
$db2 = $this->load->database('dpr',TRUE);
$otp = $this->input->post('verify_otp_number');
$today_date = date('d-m-Y');
$result =$db2->query('UPDATE dpr_book_appointment SET OTP_verified="Y" WHERE OTP_verified="'.$otp.'"');
$data = $result->result_array();
$dbotp = $data[0]["OTP_verified"];
if ($result->num_rows() > 0)
{
if($otp==$dbotp)
{
echo "OTP verified Successfully";
}
else
{
echo "OTP Not verified Successfully";
}
}
echo json_encode($result);
}
查看页面
答案 0 :(得分:0)
这可能是问题所在,
FirebaseStorage storage = FirebaseStorage.instance;
File image;
try {
//Get the file from the image picker and store it
image = await ImagePicker.pickImage(source: ImageSource.gallery);
} on PlatformException catch (e) {
//PlatformException is thrown with code : this happen when user back with don't
//selected image or not approve permission so stop method here
// check e.code to know what type is happen
return;
}
//Create a reference to the location you want to upload to in firebase
StorageReference reference =
storage.ref().child("profileImages/${user.id}");
//Upload the file to firebase
StorageUploadTask uploadTask = reference.putFile(image);
StorageTaskSnapshot taskSnapshot = await uploadTask.onComplete;
// Waits till the file is uploaded then stores the download url
String url = await taskSnapshot.ref.getDownloadURL();
您正在此处更新记录,因此$ result将仅返回布尔值,即true或false。 因此,$ data不包含任何数组,$ dbotp无法包含任何值。只需调试并检查检查器中的“网络”选项卡,您可能会出错。