Jump to content

Changing data in a field without insert?


SirChick

Recommended Posts

Is there a way to do this:

 

say i have a field as "crimeexp"

 

say the value of crimeexp is 12

 

Now cos its integer format i want to just add to it instead of replacing.

 

So something like:

 

$CrimeEXP = ['crimeexp'];

 

$CrimeEXP + 12;

 

so the new value is now 24.

 

then some how make that new $CrimeEXP be the value in the table ? Or do i have to insert and if so will it overwrite the present data in that field? or will it just add to it like this: "1212" ?

Link to comment
Share on other sites

not sure, but look in the manual for the to_int() function.  itll convert it to an integer for you.  its accepted the html frm as text.  not sure if thers an atrubute to change so that int isthe default datatype.... but itsbetter you do validation here.

 

Link to comment
Share on other sites

no no. Basically this is what happens in logical sense:

 

 

Crime exp is 12 right...(in user table)

 

Now when the script runs this is what the script should do :

 

crimeexp + 12 = crimeexp

12        +  12  = 24

 

 

so now in the table crimeexp will say 24 instead of 12... you get me ?

 

 

in the table crimeexp is set as integer

 

 

i was thinking like "UPDATE tablename WHERE crimeexp * +12 "

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.