seany123 Posted March 16, 2009 Share Posted March 16, 2009 basically i have a value called $member['money'] on this page i have $moneyreduce = ($member['money']); then i have a query which makes the value of $money become 0. now i want to echo the amount taken away... if i try echoing $moneyreduce it just shows me the value of money after the query...(0) can anyone explain how i can keep the old value? Quote Link to comment https://forums.phpfreaks.com/topic/149597-echoing-an-old-value-after-its-been-changed/ Share on other sites More sharing options...
trq Posted March 16, 2009 Share Posted March 16, 2009 You'll need to show us actual code, your not making alot of sense. Quote Link to comment https://forums.phpfreaks.com/topic/149597-echoing-an-old-value-after-its-been-changed/#findComment-785554 Share on other sites More sharing options...
sKunKbad Posted March 16, 2009 Share Posted March 16, 2009 The value of $member['money'] wil never equal $money. $money is a variable, and $member['money'] is the money key of the $member associative array. Is this your problem? Quote Link to comment https://forums.phpfreaks.com/topic/149597-echoing-an-old-value-after-its-been-changed/#findComment-785557 Share on other sites More sharing options...
seany123 Posted March 16, 2009 Author Share Posted March 16, 2009 <?php $depamount = ($player->money); //UPDATE STRENGTH. if ($_POST['full_deposit']) { if($player->money < 1) { echo"You have no money to deposit."; } $query = $db->execute("update `players` set `money`=?, `bank`=? where `id`=?", array($player->money - $player->money, $player->bank + $Player->money, $player->id )); echo "You deposited $" <?($depamount)?> "into the bank."; } } ?> So basically i want the amount to show the amount deposited... but instead it shows 0 Quote Link to comment https://forums.phpfreaks.com/topic/149597-echoing-an-old-value-after-its-been-changed/#findComment-785679 Share on other sites More sharing options...
seany123 Posted March 16, 2009 Author Share Posted March 16, 2009 anyone able to give me a hand with this? Quote Link to comment https://forums.phpfreaks.com/topic/149597-echoing-an-old-value-after-its-been-changed/#findComment-785949 Share on other sites More sharing options...
seany123 Posted March 18, 2009 Author Share Posted March 18, 2009 this has still not worked.. Quote Link to comment https://forums.phpfreaks.com/topic/149597-echoing-an-old-value-after-its-been-changed/#findComment-788106 Share on other sites More sharing options...
waynew Posted March 18, 2009 Share Posted March 18, 2009 Try <?php $depamount = ($player->money); //UPDATE STRENGTH. if ($_POST['full_deposit']) { if($player->money < 1) { echo"You have no money to deposit."; } $query = $db->execute("update `players` set `money`=?, `bank`=? where `id`=?", array($player->money - $player->money, $player->bank + $Player->money, $player->id )); echo "You deposited $depamount into the bank."; } } ?> Quote Link to comment https://forums.phpfreaks.com/topic/149597-echoing-an-old-value-after-its-been-changed/#findComment-788111 Share on other sites More sharing options...
seany123 Posted March 19, 2009 Author Share Posted March 19, 2009 again this just turns echo's the $money value (after) the query so its echoing 0. i want it to echo the amount deposited. Quote Link to comment https://forums.phpfreaks.com/topic/149597-echoing-an-old-value-after-its-been-changed/#findComment-788580 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.