Follow us on Twitter!
It is the path of least resistance that makes rivers and men crooked. - Bj Palmer
Thursday, February 11, 2016
Navigation
Home
 Find:
 Information:
Learn
Communicate
Submit
Shop
Challenges
 Exploit:
 Programming:
 Think:
 Track:
 Patch:
 Other:
 Need Help?
Other
Members Online
Total Online: 29
Guests Online: 28
TeamSpeak Online : 5 Members Online: 1

Registered Members: 92308
Newest Member: mcferren
Latest Articles
View Thread

HellBound Hackers | Computer General | Webmasters Lounge

Author

PHP Update HELP!!!!


Member

Your avatar

Posts:
Location:
Joined: 01.01.70
Rank:
Guest
Posted on 17-07-07 23:38
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
Author

RE: PHP Update HELP!!!!


Member

Your avatar

Posts:
Location:
Joined: 01.01.70
Rank:
Guest
Posted on 18-07-07 01:40
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"]) . "'"Wink, 0);
$points = $current_points + 10;
$update = mysql_query("UPDATE users SET points = $points WHERE user_name = '" . mysql_real_escape_string($_SESSION["user_name"]) . "'"Wink;


as to your other problem, I'd have to see more of your code.