php - remove amount from price then insert new price
So i have a question. I have no idea how i need to insert a search in google for it so i'm going to ask it here.
I have like 50.00 euro. in mysql table it is showed as
Id | Username | Balance
1 | Kev | 50.00
Now when i buy something that is worth like lets say 5.00 euro it would be 50.00 - 5.00 = 45.00 euro left on balance
Id | Username | Balance
1 | Kev | 45.00
Now my question is. How do i do this with a simply get old balance then insert the new balance into the table? Also i'm using PDO
Sorry for my nooby question but i have no idea how to insert this into a search in google.
~Kev
Answer
Solution:
You can update a row by setting the column equal to the current column value minus (or plus) another value
or