Jump to content

[SOLVED] Add to a database value. (noob question)


MadnessRed

Recommended Posts

OK,  I am still very new to this kinda thing.

What i want to do is, add a number to an already existing number.

 

Eg, if in the database it said 9, I could add 5 more to that.

 

Is there a simple way to do this, or do I find the old value, add the new value to it, then write it, or can I just add it?

 

Here is an example

$old = $row['Description'];
$plus = $_GET["plus"];

$new = $old + $plus;

$query1 = "UPDATE `madnessred_sites` SET `Count` = '$new' WHERE `ID` ='$id'";

 

Could I instead do something like

 

$query1 = "UPDATE `madnessred_sites` ADD TO `Count` = '$new' WHERE `ID` ='$id'";

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.