-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdeletebatch.php
More file actions
68 lines (46 loc) · 1.56 KB
/
deletebatch.php
File metadata and controls
68 lines (46 loc) · 1.56 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
<?php
include "includes/base.php";
?>
<html>
<head>
<title>Delete</title>
<link rel="stylesheet" type="text/css" href="stylesheet.css">
</head>
<body>
<?php include("includes/header.php");?>
<?php include("includes/nav.php");?>
<div id='section'>
<?php
if($_POST['deletetable']!=''){
$table = htmlspecialchars($_POST['deletetable']);
}
if($_POST['deleteid']!=''){
$id = htmlspecialchars($_POST['deleteid']);
}
//ALTER TABLE city DROP FOREIGN KEY `city_ibfk_1`;
//ALTER TABLE city ADD CONSTRAINT `city_ibfk_1` FOREIGN KEY (`CountryCode`) REFERENCES `country` (`Code`) ON DELETE CASCADE;
//ALTER TABLE countrylanguage DROP FOREIGN KEY `countryLanguage_ibfk_1`;
//ALTER TABLE countrylanguage ADD CONSTRAINT `countryLanguage_ibfk_1` FOREIGN KEY (`CountryCode`) REFERENCES `country` (`Code`) ON DELETE CASCADE;
$sql = "DELETE FROM " . $table . " WHERE batch_id = ?";
if($stmt = mysqli_prepare($link, $sql)){
mysqli_stmt_bind_param($stmt,'s',$id);
mysqli_stmt_execute($stmt);
mysqli_stmt_close($stmt);
$_SESSION['success'] = "Success: Batch with ID " . $id . " successfully deleted from schedule.";
header("location:schedule.php");
exit();
}
else {
$_SESSION['error'] = "Error: Batch with ID " . $id . " not successfully deleted.";
header("location:schedule.php");
exit();
}
//echo '<meta http-equiv="refresh" content="1; URL=failure.php" />';
?>
</div>
<?php include("includes/footer.php");?>
</body>
</html>
<?php
mysqli_close($link);
?>