...

View Full Version : Simple PHP script adding up numbers



Scyko
06-23-2011, 01:21 PM
Hey guys.

I'm a total noob at PHP & MySQL. I want to write a simple script to add numbers into a database. I also want to be able to add up (as in methematical addition) further numbers in.

Eg. user1 has 50 points. he earns 20 pts. So how do I add it so he has 70 points?

I am not an expert and I'm just randomly thinking up scripts to write so I can learn things. Any help is appreciated :)

Fumigator
06-23-2011, 04:24 PM
UPDATE your_table
SET your_column = your_column + 20
WHERE user_name = 'user1'

myfayt
06-24-2011, 03:02 PM
For an example of what fumigator said. "Also uour script may be different than mine"


mysql_query("UPDATE users SET points=points+20 WHERE id='" . row["id"] . "' LIMIT 1");

Scyko
07-01-2011, 06:57 AM
Thanks guys. Does what I was hoping to do. Much appreciated for the help :thumbsup:



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum