I have no idea why this simple mathematical equation doesn't work. It's making me crazy - am I blind? Instead of subtracting $number
from $Amount2
it produces a negative number. So if $Amount2
starts with a value of 100 and $number
is a value of 10 I get -10 instead of 90 as the result.
//find how much green they are holding
$resultto = db_query("SELECT * FROM Users_Panickles WHERE PSID ='$PSID'");
$rowgifter = db_fetch_array($resultgifter);//fetch the name of the giftee character
$Amount2 = $resultgifter["Amount"];
//now alter the accounts
$Amount2 = $Amount2 - $number; //subtract the gift from the gifter's account and update the record
db_query ("UPDATE Users_Panickles SET Amount='$Amount2' WHERE PSID = '$PSID'");