Jump to content

SQL DB Sending old results


jack7076

Recommended Posts

I am creating a website which uses a mysql database.

Which holds user information and there balance.

 

When a user purchases tokens (via Stripe) They are redirected back to the account management page.

 

I have checked stripe and they have confirmed the payment.

 

I have checked the sql database and the token value has been added.

 

But on the management page the token value is still the same.

 

(cacheing has been disabled.) Here is the code: 

            <?php 
                
                $query = $conn->prepare("SELECT ID, username, fname, lname, email, tokens FROM `users` WHERE ID = ?");
                $query->bind_param("s",$_SESSION['ID']);
                $query->execute();
                $query->bind_result($ID, $username, $firstname, $lastname, $email, $tokens);
                $query->fetch();
                $query->close();
            ?>
            <p class="my-account-p-padded">
    
                <br>
                Username: <?php echo $username; ?><br>
                First Name: <?php echo $firstname; ?><br>
                Last Name: <?php echo $lastname; ?><br>
                Account Tokens: <?php echo $tokens; ?> <a href="javascript:void(0)" onclick="showlightbox();" id="addmoretokensbtn">Add More</a><br>
                <span id="explain" style="display: none;">(Scroll Up to see screen)</span>
                
            </p>

Screenshot of db: 

Attached.

 

Screenshot of Page:

Attached.

post-192156-0-43306200-1505456604_thumb.png

post-192156-0-03514300-1505456659_thumb.png

Link to comment
Share on other sites

Add a little bit to the code:

            <?php 
                
                $query = $conn->prepare("SELECT ID, username, fname, lname, email, tokens, NOW() FROM `users` WHERE ID = ?");
                $query->bind_param("s",$_SESSION['ID']);
                $query->execute();
                $query->bind_result($ID, $username, $firstname, $lastname, $email, $tokens, $now);
                $query->fetch();
                $query->close();
            ?>
            <p class="my-account-p-padded">
    
                <br>
                Username: <?php echo $username; ?><br>
                First Name: <?php echo $firstname; ?><br>
                Last Name: <?php echo $lastname; ?><br>
                Account Tokens: <?php echo $tokens; ?> <a href="javascript:void(0)" onclick="showlightbox();" id="addmoretokensbtn">Add More</a><br>
                PHP Time: <?php echo date("Y-m-d H:i:s"); ?><br>
                DB Time: <?php echo $now; ?><br>
                <span id="explain" style="display: none;">(Scroll Up to see screen)</span>
                
            </p>
Do you see the two times changing?
Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.