gpt4 book ai didi

PHP 代码工作正常,但验证消息未显示

转载 作者:行者123 更新时间:2023-11-29 10:49:36 25 4
gpt4 key购买 nike

我想在 for 循环中运行 MySQL 更新查询后显示验证消息。我在下面编写了源代码,但验证消息没有显示。我不知道这是怎么回事。

这是我的 PHP 代码

<?php
// Update All rows start
for ($i=0; $i<$setTotalRows ; $i++)
{
$GetChecked = isset($_POST['txtChecked'.$i]);
$GetTransCode = $_POST['txttransCode'.$i];
$GetTransType = $_POST['txttransSetType'.$i];
$GetTransMethod = $_POST['txtPaymentMethod'.$i];
$SetEncodedDate = date("Y-m-d H:i:s");
if (empty($GetChecked)) { //Start Else
continue;
} else if (!empty($GetChecked) && $GetTransType == "ErrorType") {
continue;
} else {
if($GetTransType == "Debit") { //Check For Cashin Cashout Start
$SetTableName = "tblbank_cashin";
} else {
$SetTableName = "tblbank_cashout";
} //Check For Cashin Cashout End

//Method Start
switch ($GetTransMethod) {
case "1":
$SetPayMode = "Cash Deposit";
break;
case "2":
$SetPayMode = "Online Transfer";
break;
case "3":
$SetPayMode = "Cheque Transfer";
break;
case "4":
$SetPayMode = "Cash Withdrawal";
break;
case "5":
$SetPayMode = "Cheque Withdrawal";
break;
default:
$SetPayMode = "Cash Deposit";
}
// Method End

$sql_update = "UPDATE ". $SetTableName. " SET ";
$sql_update .= "transRecon='1'";
$sql_update .= ", transReconDate='$SetEncodedDate'";
$sql_update .= ", transType='$SetPayMode'";
$sql_update .= " WHERE transCode='$GetTransCode'";
$result_reconcile = mysqli_query($conn,$sql_update);
if(!$result_reconcile){
die("SQL Error: " . mysqli_error($conn));
//echo $result_reconcile;
}
} //End Else

} //End For i loop

if(isset($result_reconcile)){
$sucess = "<div class='alert alert-success'><strong><i class='fa fa-check' aria-hidden='true'></i> Perfect!</strong> payment(s) has been reconciled</div>";
header('Refresh: 3;url=banks?P=All&E='.$view_bankid);
} else {
$error_display = "<div class='alert alert-warning'><strong>ERROR!</strong> An error occured. Please Try Again Here</div>";
}
//Update All rows End
?>

最佳答案

必须在显示任何输出之前发送 PHP header ,您也永远不会显示 $success,因为您只设置变量,而不会回显它。

如果您能够使用Javascript,然后在php本身中回显您的$success,那么我建议使用jQuery进行以下操作,在php $之后回显成功消息。

<script>$(document).ready(function(){
setTimeout(function(){
window.location.replace("some webpage here");
}, 3000);
});</script>

关于PHP 代码工作正常,但验证消息未显示,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43965753/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com