I have what i thought was a simple problem but i cant figure it out.
All i want to to, is add a value to an in field.
If i had an int field called number and in it was the value 5, what i want to do is add three to it so number becomes 8.
I use the UPDATE method in mysql like so
$sql = mysql_query("UPDATE profiles SET positive=$positive, negative=$negative,neutral=$neutral WHERE id=$to")
this is supposed to add the int value $positive ect to whats already in the positive column but the way i'm doing it now it just replaces whats in the column. So instead of adding 3 like my previous example to make 8, it replaces the 5 with 3.
Hope that makes sense.
Thanks for any help
How to add a number to an int field?
1 reply to this topic
Posted 20 November 2005 - 09:18 PM
$sql = mysql_query("UPDATE profiles SET positive=positive+$positive, negative=negative+$negative,neutral=neutral+$neutral WHERE id=$to")
Please use EDIT * 100...
or [php] * 1000... PLEASE READ THE POSTED SOLUTIONS CAREFULLY * 1000000...
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users