Our sponsor needs your help!
~ Thanks for your help
|I am trying to update a MySQL database and add a number to an variable that already has an int stored in to for example i ahve 10 and i want to add 10 so it will make 20 when i UPDATE points SET points += 10 FROM users WHERE user_name= $_SESSION['user_name'] it will not update my SQL i was wondering what i was doing wrong.|
Also i need some help with then printing off that session variable when i change the number to anything but 0 it does not show the number i use echo $_SESSION['points'];
Please i really would like some help with this
*** also if your intrested in helping develop my webpage let me know
http://blackmind.. . .munity.org
Edited by on 17-07-07 23:48
|i dont think sql supports the += operator so just use|
$current_points = mysql_result(mysql_query("SELECT points FROM users WHERE user_name = '" . mysql_real_escape_string($_SESSION["user_name"]) . "'"
$points = $current_points + 10;
$update = mysql_query("UPDATE users SET points = $points WHERE user_name = '" . mysql_real_escape_string($_SESSION["user_name"]) . "'"
as to your other problem, I'd have to see more of your code.