I have the following function in PHP
function verificar_status(){
global $db, $username, $usua, $ci_nro_cuenta, $monto, $nro_transf, $banco_emisor, $banco_destino, $fecha_transf, $status_pedido, $fecha_pedido, $status_pago, $fecha_aprobacion;
$query = "SELECT * FROM pedidos WHERE usuario = '$usua' AND status_pedido = 'ESPERANDO' ";
$result = mysqli_query($db, $query);
$rows = mysqli_num_rows($result);
if ($rows > 0){
echo '<div class="alert alert-danger" role="alert"" >
<h3>
LO SENTIMOS, USTED POSEE UN PEDIDO EN ESPERA
</h3>
</div>';
} else {
verificar_pago_mes();
echo ' <form autocomplete="off" class="was-validated" method="post" action= "pedidos.php">
AQUI VA UN FORMULARIO
</form>';
}
}
//y por otra parte tengo la function
function verificar_pago_mes() {
global $db, $username, $usua, $mes_de_pago_actual;
$query = "SELECT * FROM pagos WHERE user = '$usua' AND mes_de_pago = '$mes_de_pago_actual'";
$result = mysqli_query($db, $query);
$rows = mysqli_num_rows($result);
if ($rows > 0){
echo '<div class="alert alert-info" role="alert"" >
<h3>'
.$mes_de_pago_actual .' Pagado
</h3>
</div>';
} else {
echo '<div class="alert alert-danger" role="alert"" >
<h3>
Lo sentimos usted no ha efectuado el pago correspondiente a ' .$mes_de_pago_actual .'
</h3>
</div>';
exit;
}
}
My intention is that after analyzing verificar_pago_mes()
can be executed within verificar_status()
but it turns out that it does not show anything in the MODAL where verificar_status()
is leaving if I comment the last line exit;
if it shows the alert but it also shows the form.
Try doing if (verificar_pago_mes()=true)
but logically indicate me error ..!
I appreciate any idea that allows me to implement the function correctly.