fix the delete function

This commit is contained in:
Andreas Zweili 2017-03-07 20:29:02 +00:00
parent 390482daea
commit 1c5f7d42c1
1 changed files with 10 additions and 2 deletions

View File

@ -206,9 +206,17 @@ function delete_demand()
/* assign the variable with data from the delete button */
$demandId = $_POST['demandId'];
/* Delete all the offers corresponding to the demandId
from the database */
$delete_offers_query = "DELETE FROM offers WHERE demandId='$demandId'";
$delete_offers_result = mysqli_query($con, $delete_offers_query)
or die(mysqli_error($con));
// Delete the demand matching the demandId from the database
$sql = "DELETE FROM demands WHERE demandId='$demandId'";
$result = mysqli_query($con, $sql) or die(mysqli_error($con));
$delete_demand_query = "DELETE FROM demands WHERE demandId='$demandId'";
$delete_demand_result = mysqli_query($con, $delete_demand_query)
or die(mysqli_error($con));
header('Location: board.php');
}
}