PHP - 简单减法不会加起来

时间:2016-03-13 22:05:46

标签: php

我不知道为什么这个简单的数学方程式不起作用。它让我发疯 - 我是个瞎子吗?它不会从$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'");

0 个答案:

没有答案