I want to display a page, if user doesn't pay for content (via Stripe) and therefore have to check in DB if he paid or not. If he paid, I store string "ok" into status and if he doesn't it's just blank.
Now I'm not sure why the following code doesn't work:
<?php
if(!isset($_SESSION["username"])) {
?>
    <a href="login.php">Login</a> to watch Satellite data.
<?php
    $query = 'SELECT status 
                FROM users 
                WHERE username="'.$_SESSION["username"].'"';
    $stmt = $conn->prepare($query);
    $stmt->execute();
    $result = $stmt->get_result();
    while ($row = $result->fetch_assoc()) { 
        $status = $row["status"]; 
        if ($status !== "ok") {
            $status_notpaid = true;
        } 
    }
} elseif(isset($_SESSION["username"]) && isset($status_notpaid))  {     
    include("notpaid.php"); 
} else {
?>
<?php 
$query = 'SELECT id 
            FROM users 
            WHERE username="'.$_SESSION["username"].'"';
$stmt = $conn->prepare($query);
$stmt->execute();
$result = $stmt->get_result();
?>
Hello <strong><?php echo $_SESSION["username"];?></strong> | 
<?php 
while ($row = $result->fetch_assoc()) { 
    echo $row["id"]; }
?> 
I'm not sure why elseif(isset($_SESSION["username"]) && isset($status_notpaid)) { include("notpaid.php"); } doesn't work.

 
     
    