SEVIZ Posted May 19, 2009 Share Posted May 19, 2009 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! Link to comment https://forums.phpfreaks.com/topic/158683-subtract-two-numbers-and-enter-result-into-db/ Share on other sites More sharing options...
daveoffy Posted May 19, 2009 Share Posted May 19, 2009 you are on the right path. $money = $_POST['MAXAMOUNT'] - $_POST['TOTAL']; $id = $_POST['ID']; $qry = "INSERT INTO 'orderform' (money) VALUES('$money') WHERE id='$id'" $result = @mysql_query($qry); Link to comment https://forums.phpfreaks.com/topic/158683-subtract-two-numbers-and-enter-result-into-db/#findComment-836898 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.