I have this short code but i want it to be relative with the current value, Like if the XP value is 3 and i run this script it will make so that the total value is 39. Any ide? Code:
<?php
include "base.php";//This is the connection file
mysql_query("UPDATE test SET XP=+36 WHERE Username='Hello'");
?>
EDIT:
I solved it by my self:
<?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'");
?>
Change query to this
"UPDATE test SET XP=XP+36 WHERE Username='Hello'"
You are using =+ that is wrong it is not supported in mysql