我有这个短代码,但我希望它与当前值相关,就像 XP 值为 3 并且我运行此脚本时,它将使总值为 39。任何 ide?代码:
<?php
include "base.php";//This is the connection file
mysql_query("UPDATE test SET XP=+36 WHERE Username='Hello'");
?>
编辑:
我自己解决了:
<?php
include "base.php";
$query = "SELECT * FROM test WHERE Username='Hello'";
$result = mysql_query($query) or die(mysql_error());
$row = mysql_fetch_array($result) or die(mysql_error());
echo $row['Username']. " - ". $row['XP'];
mysql_query("UPDATE test SET XP='" .$row['XP']. "'+1 WHERE Username='Hello'");
?>