2
Good evening, I am trying to do a check on my website. If the customer balance, that is set by a $_SESSION.
If it has a balance less than the price of the product, it would have to do this:
$saldo = $_SESSION['saldo'];
$procuraPreco = mysqli_query($connect, "SELECT preco FROM infs WHERE id='$id'");
$retornaPreco = mysqli_fetch_all($procuraPreco,MYSQLI_ASSOC);
$preco = $retornaPreco[0]['preco'];
if(isset($_POST['comprar'])) {
if($saldo < $preco) {
die('<script>alert("Pedido recusado. Razão: Saldo insuficiente"); window.location = "shop.php";</script>;');
}
Only Alert is not shown on the page and it only appears in Sponse (F12):
<script>alert("Pedido recusado. Razão: Saldo insuficiente"); window.location = "shop.php";</script>
Note: I do a POST on the same page that the customer clicks to buy.
Any error in console?
– Guilherme Nascimento
No, no....
– PLINIO RODRIGUES