How to produce error message when user click on the button in php?

I'm creating a function where user cannot claim today's money transaction in their account. But still can view their today's transaction. So I wanted to create a message to inform user that if user want's to claim their today's transaction, they cannot do that. They will have to comeback tomorrow if they want. This is what I'have tried but it's not working and it did not show the message. I'm trying to display the message of Comeback tomorrow!

$connection = mysqli_connect("lolo","hahaha","", "eh");
        $ql="UPDATE kola SET setatus ='upgrade' WHERE ID = 'opopo1' AND 
        DATE(date) !=CURRENT_DATE() ";
        $ql_claim = mysqli_query($connection,$ql);
        
        if(mysqli_affected_rows($ql_claim) > 0 ) {
            echo "<script>alert('Successful!')</script>";
            echo "<script>window.location = 'nextPage.php'</script>";  
        }
        else
        echo "<script>alert('Comeback tomorrow!')</script>";
     }
     


I wanted to display the Comeback tomorrow alert but my alert are not working.



Read more here: https://stackoverflow.com/questions/64403955/how-to-produce-error-message-when-user-click-on-the-button-in-php

Content Attribution

This content was originally published by waima at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: