Addition with MySQL

Status
Not open for further replies.

Dave

Banned
Jun 24, 2006
811
6
0
34
Australia
I'm pretty sure this is like a basic thing, but I've just never learnt how do it.

I am going to have a Number stored in a database, and I was wondering how i would go about adding to this number (ie, not replacing it).

Eg. Value = 10
+ 15

= 25

Basic stuff, I just don't know how to program it.
 


Using PHP, I presumem you would do a select from the database into a variable. Add whateve number you want to the variable and then do a replace back into the database.

Do you want some specific code?
 
if you know basic sql, and php you should be able to put it together. make sure the field in the db is set as an int or num field... use the SELECT columname FROM tablename WHERE this=that sql command to get the number out. $varname .= 5; the use the sql update function to update the same field you originally grabbed the number from.
 
Status
Not open for further replies.