Jump to content

How to add a number to an int field?


onemind

Recommended Posts

Hi,

 

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.

 

eg

 

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 :)

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.