<?php
require 's*****.php';
I have MySQLi columns called balance, balancedeficit, overallbalance, price, totalprice and offcourse id in my table Warehouse. So my problem is below.
$sql = "UPDATE Warehouse SET balance ='" . $_POST['Warehouse_balance'] ."'
, balancedeficit ='" . $_POST['Warehouse_balance'] . "' - overallbalance '
, totalprice ='balancedeficit * price' WHERE id=" . $_POST['Warehouse_id'];
So I want that when balance get updated from form, my SQL query calculates all the rest. How should I edit that query or what should I do.
$sql = "UPDATE Warehouse SET balance ='" . $_POST['Warehouse_balance'] ."', editor='" . $_POST['Warehouse_editor'] ."' WHERE id=" . $_POST['Warehouse_id'];
Above is working little bit different sql query without those calculations
if ($conn->query($sql) === TRUE) {
echo "<meta http-equiv='refresh' content='0;url=index.php' />";
} else {
echo "
<meta http-equiv='refresh' content='8;url=index.php' />
<h1>VIRHE!</h1>Tarkista syötetyt tiedot. Sivu palautuu 8 sekunnin päästä takaisin. " . $conn->error;
}
$conn->close();
?>
Thanks for the replies.