Repository navigation
Expand file tree
/
Copy pathdelete.php
More file actions
127 lines (86 loc) · 1.92 KB
/
Copy pathdelete.php
File metadata and controls
127 lines (86 loc) · 1.92 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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
<?php
// Connecting to the Database
$servername = "localhost";
$username = "root";
$password = "";
$database = "hams_db";
// Create a connection
$conn = mysqli_connect($servername, $username, $password , $database);
// check for if connection was not successful
if(!$conn)
{
?>
<script>
alert('Databse is not connected')
</script>
<?php
die("Sorry we failed to connect: ". mysqli_connect_error());
}
//getting key
$check = $_GET['student_id'];
//deleting data from student table
$sql = "DELETE FROM mess WHERE student_id = '$check' ";
$result = mysqli_query($conn, $sql);
// check for if form submission is not successful
if(!$result)
{
?>
<script>
alert('Error deleting data of mess');
</script>
<?php
}
//deleting data from student table
$sql = "DELETE FROM laundary WHERE student_id = '$check' ";
$result2 = mysqli_query($conn, $sql);
// check for if form submission is not successful
if(!$result2)
{
?>
<script>
alert('Error deleting data of laundary');
</script>
<?php
}
//deleting data from student table
$sql = "DELETE FROM fee WHERE student_id = '$check' ";
$result3 = mysqli_query($conn, $sql);
// check for if form submission is not successful
if(!$result3)
{
?>
<script>
alert('Error deleting data of fee');
</script>
<?php
}
//deleting data from student table
$sql = "DELETE FROM student WHERE student_id = '$check' ";
$result4 = mysqli_query($conn, $sql);
// check for if form submission is not successful
if(!$result4)
{
?>
<script>
alert('Error deleting data of student');
</script>
<?php
}
// check for if data successfull deleted
if($result && $result2 && $result3 && $result4)
{
?>
<script>
alert('DATA has deleted successfully');
</script>
<?php
}
else
{
?>
<script>
alert('Error deleting data');
</script>
<?php
}
?>