Refresh to notice difference?

Hello guys,

Below i have supplied test code that I have been playing with to try and figure out why its not working on my official page. Of course its much more simplified but you get the idea.

Description/Run Through: So basically I have it accessing a row in my database, and then getting a variable in the “cash” column. I have a button that if pressed, it takes my cash and subtracts one from it. “Button Pressed” Was added to make sure the button was being pressed, which is was. Then it updates the new cash level back into the database. On the page it displays the button and the variable for total cash.

Problem: When I press the button it, gets the new variable and puts it in the database. But it doesn’t change visually until I refresh the page.

Link: http://terminaldirective.site90.net/test.php

Code: [php]

<?php mysql_connect("-", "-", "-") or die(mysql_error()); mysql_select_db("-") or die(mysql_error()); $data = mysql_query("SELECT * FROM mem_resources WHERE username = 'Birdum'") or die(mysql_error()); while ($row = mysql_fetch_assoc($data)) { $totalcash = $row['cash']; } if ($_POST['buy']) { echo "Button pushed"; $totalcash = $totalcash - 1; mysql_query("UPDATE mem_resources SET cash = '$totalcash' WHERE username = 'Birdum'") or die(mysql_error); } echo ""; echo ""; echo ""; echo "Current Cash: $totalcash"; ?>[/php]

Thanks in Advance!

Birdum

I just tried your script in FireFox and it is working fine here. Try to check with different browser.

Oops forgot to inform you, I fixed it. Thanks though!

Sponsor our Newsletter | Privacy Policy | Terms of Service