thisisnuts123 Posted November 5, 2007 Share Posted November 5, 2007 hello guys i wana be able to add value to the filed so if the field has 1000 i wana add another 1000 to make it 2000 how can this me done? mysql_query("UPDATE user SET `points` = 'point + 1000' WHERE `username` = '$_SESSION[user]'"); Quote Link to comment https://forums.phpfreaks.com/topic/76042-solved-adding-value-to-it-self-mysql/ Share on other sites More sharing options...
Zane Posted November 5, 2007 Share Posted November 5, 2007 mysql_query("UPDATE user SET `points` = (`points`*2) WHERE `username` = '$_SESSION[user]' AND points = 1000") or die(mysql_error()); Quote Link to comment https://forums.phpfreaks.com/topic/76042-solved-adding-value-to-it-self-mysql/#findComment-384935 Share on other sites More sharing options...
thisisnuts123 Posted November 5, 2007 Author Share Posted November 5, 2007 sorry 1000 was just an example they start off with 0 points mysql_query("UPDATE user SET `points` = point + 1000 WHERE `username` = '$_SESSION[user]'"); i made the filed have 1000 points as default now every time they get an answer right the points increase so it;s working.. but if i start them off with 0 point the value stays at 0 not sure why Quote Link to comment https://forums.phpfreaks.com/topic/76042-solved-adding-value-to-it-self-mysql/#findComment-384936 Share on other sites More sharing options...
Barand Posted November 5, 2007 Share Posted November 5, 2007 mysql_query("UPDATE user SET `points` = pointS + 1000 WHERE `username` = '$_SESSION[user]'"); Quote Link to comment https://forums.phpfreaks.com/topic/76042-solved-adding-value-to-it-self-mysql/#findComment-384956 Share on other sites More sharing options...
thisisnuts123 Posted November 5, 2007 Author Share Posted November 5, 2007 lol nice catch thanks!!! Quote Link to comment https://forums.phpfreaks.com/topic/76042-solved-adding-value-to-it-self-mysql/#findComment-384970 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.