Page 1 of 1

additions and Subtraction

Posted: Mon Sep 09, 2002 6:22 am
by Love_Daddy
Hi All,

I need to do the following in PostgreSQL

1) Get a number from a user
2) Add or substract the number to an existing number in the database

For instance:

A user enters 10 to a form..

and in my database I have 15 of which I need to substract from the user number
how do I write the select?

I've tried:
Select value - $user_value as new_value from Table
So how do I update the table? - so that my new valuew will show?

Posted: Mon Sep 09, 2002 7:19 am
by m3mn0n
thoses seem pretty basic, have you tried the documentation at there site?

Posted: Mon Sep 09, 2002 8:12 am
by Love_Daddy
Okay! - I figured it out.
What I did was, After accepting a value from a user, I do my basic calculations using
PHP and then update my table.

Very easy!

Posted: Mon Sep 09, 2002 8:56 am
by m3mn0n
good work! :wink: