is it possible to show sweet alert pop-up to desired session?
This is how i set session for every user:
$_SESSION['username'] = $username;
And i have no idea how should i complete the next step, any thoughts ? What I'm trying to achieve is once postbacks sends data and updates points for user i want to show him a sweet alert.
sid equals to username
$getusername = mysqli_real_escape_string($db,$_GET['sid']);
$query = "UPDATE users SET points = points + '$okpayout' WHERE username='$getusername' ";
mysqli_query($db, $query);
You can check for data in session and then based on that show the sweetalert in the view:
<?php
$session_data = $_SESSION['field'] ?? null; // With php >= 7
$session_data = isset($_SESSION['field']) ? $_SESSION['field'] : null; // With php < 7
if ($session_data && $session_data == "value") {
echo '
<script> swal("Done!"); </script>
';
}
?>