$show = mysqli_query($con, "SELECT Coins FROM Leaderboard WHERE Username = '".$user."'; ");
我需要创建一个php页面,当它打开时,它会将Coins字段中的值转换为Coins字段的当前值 - 200.任何方式如何?感谢
答案 0 :(得分:2)
这应该有效:
mysqli_query($con, "UPDATE Leaderboard SET Coins = (Coins - 200) WHERE Username = '".$user."';");
答案 1 :(得分:0)
或者如果您只想显示-200不更新,请使用
$show = mysqli_query($con, "SELECT (Coins - 200) AS Coins FROM Leaderboard WHERE Username = '".$user."'; ");