我不知道为什么这个简单的数学方程式不起作用。它让我发疯 - 我是个瞎子吗?它不会从$number
中减去$Amount2
而是产生负数。因此,如果$Amount2
的值为 100 且$number
的值为 10 ,则会获得 -10 结果是 90 。
//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'");