Jump to content

Subtract two numbers and enter result into DB?


SEVIZ

Recommended Posts

I have two numbers in a php script.  They are called into my process php file via post.  Inside the process php file I need to subtract the one from the other like this:

$_POST["MAXAMOUNT"]  -  $_POST["TOTAL"]  =  Number here

 

Once the math is done I want to run a query to a database to insert that value into a row depending on the ID that submitted the form. 

 

So in all here is what I am trying to do in basic terms. 

$_POST["MAXAMOUNT"]  -  $_POST["TOTAL"]  =  Number here

Number here = $number
$_POST["ID"] = $id


$query="INSERT INTO orderform (balance) WHERE id='$id' VALUES ('$number')";


 

Is that kinda right?  Am I on the right path?  Any help is appreciated!

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.