我知道有几个问题有这样的答案,但由于一个奇怪的原因我不知道,这些似乎都没有解决我的问题。当我使用我的代码时,我没有错误,但我的数据库中的值似乎没有得到更新。
$outcomeNum = rand(14, 19);
if (checkRandom($chance['1'])) {
echo "You took the hobos cup and you earned " . $outcomeNum . " dollars.";
$data->query("UPDATE players SET money = (money + $outcomeNum) WHERE id = '".$id."'");
} else {
if (checkRandom(25)) {
echo "You thought twice about it when you was sent a creepy look from the hobo.";
} else {
echo "You got beaten up by the hobo and you lost " . $outcomeNum . " health.";
$data->query("UPDATE players SET health = (health - $outcomeNum) WHERE id = '".$id."'");
}
}
答案 0 :(得分:0)
$sql
变量并回显它。