Store variable from SQL Table to use later using PHP
I would like to be able to store a variable from a column to use to update a variable in another column.
Here is my code:
$sqlPlaceNumber = "SELECT @locationPlace := `$locationPlace` FROM `$className` WHERE `Vehicle` = `$vehicleName` "; $results = mysqli_query($con, $sqlPlaceNumber) or die(mysqli_error($con)); $sqlUpdate = "UPDATE `$className` SET `$location` = 31-`@locationPlace` WHERE Vehicle = `$vehicleName`"; mysqli_query($con, $sqlUpdate) or die(mysqli_error($con));
I would like to store the value of column "Colby, WI Place" to use to subtract it from 31 to get the value for column "Colby, WI"
31-"Colby, WI Place" = new value for "Colby, WI"