Initial commit
This commit is contained in:
39
indexes/manage/fruit_del.php
Normal file
39
indexes/manage/fruit_del.php
Normal file
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
include '../ConnectDB.php';
|
||||
|
||||
if(isset($_GET["name"])) {
|
||||
$name = $_GET["name"];
|
||||
|
||||
// Delete from the inventory table
|
||||
$sql_clear_inventory = "DELETE FROM inventory WHERE name='$name'";
|
||||
$res_1 = mysqli_query($conn, $sql_clear_inventory);
|
||||
if(!$res_1){
|
||||
echo "<br><br><br><br><br><br><br><br>";
|
||||
echo "Error deleting from inventory: " . mysqli_error($conn);
|
||||
return;
|
||||
}
|
||||
|
||||
// Drop the column from the buyer table
|
||||
$sql_clear_buyer = "ALTER TABLE buyer DROP COLUMN `$name`";
|
||||
$res_2 = mysqli_query($conn, $sql_clear_buyer);
|
||||
if(!$res_2){
|
||||
echo "<br><br><br><br><br><br><br><br>";
|
||||
echo "Error dropping column from buyer table: " . mysqli_error($conn);
|
||||
return;
|
||||
}
|
||||
|
||||
// Drop the column from the seller table
|
||||
$sql_clear_seller = "ALTER TABLE seller DROP COLUMN `$name`";
|
||||
$res_3 = mysqli_query($conn, $sql_clear_seller);
|
||||
if(!$res_3){
|
||||
echo "<br><br><br><br><br><br><br><br>";
|
||||
echo "Error dropping column from seller table: " . mysqli_error($conn);
|
||||
return;
|
||||
}
|
||||
|
||||
echo "<script type='text/javascript'>
|
||||
alert('Successfully deleted!');
|
||||
window.location.href = './edit.php';
|
||||
</script>";
|
||||
}
|
||||
?>
|
||||
Reference in New Issue
Block a user