First of all, I would make sure that $SumTotal
and $_SESSION['OrderCustomerID']
are equal to what they are meant to be equal to.
I would do something like: echo "$SumTotal";
and echo $_SESSION['OrderCustomerID'];
to check these variables.
Then, you could do the following:
- Make sure that the database is actually selected (to select the database in your query, you can use
UPDATE databasename.table
(where table
is equal to OrderCustomer in your case)
- Check for errors in your query by adding
or die(mysql_error());
to the end of your query.
- Use the following at the very top of your PHP document to show all errors that have occurred: https://stackoverflow.com/a/6575502/3593228.
In addition to this, make sure that your query is actually being executed.
You can do this by using the mysql_query
function as follows:
$strSQL3 = mysql_query("UPDATE databasename.OrderCustomer SET TotalPrice = '$SumTotal' WHERE OrderCustomerID = '" . $_SESSION["OrderCustomerID"] . "'");
Also, before someone beats me to it, you should be using PDO or MySQL Improved, yada yada yada.