-
Notifications
You must be signed in to change notification settings - Fork 0
/
DELETE.php
86 lines (61 loc) · 1.53 KB
/
DELETE.php
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
<html>
<head>
<title>SELECT</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" type="text/css" href="LOGIN1.css"> -!>
</head>
<body>
<div id="body">
<?php
$eUID = $_POST['UID'];
if ( !empty($eUID) )
{
$servername = "localhost";
$username = "root";
$dbname ="sugan_SF";
// Create connection
$conn = new mysqli($servername, $username,"",$dbname);
// Check connection
if ($conn->connect_error)
{
die("Connection failed: " . $conn->connect_error);
}
else
{
$SELECT1 = "SELECT * FROM FARMER WHERE UID=$eUID";
$RSLT1 = mysqli_query($conn, $SELECT1);
if (mysqli_num_rows($RSLT1) == 0 )
{
echo "Entered UID does not match any records!";
echo file_get_contents("WELCOME.html");
}
else
{
$DELETE1= "DELETE FROM `WAREHOUSE` WHERE `eUID`=$eUID" ;
$DELETE2= "DELETE FROM `LAND` WHERE `eUID`=$eUID" ;
$DELETE3= "DELETE FROM `MACHINERY` WHERE `eUID`=$eUID" ;
$DELETE4= "DELETE FROM `FARMER` WHERE `UID`=$eUID" ;
$RESULT1 = mysqli_query($conn, $DELETE1);
$RESULT2 = mysqli_query($conn, $DELETE2);
$RESULT3 = mysqli_query($conn, $DELETE3);
$RESULT4 = mysqli_query($conn, $DELETE4);
echo("<script type=\"text/javascript\">
window.alert('Record has been successfully removed');
window.location.href='WELCOME.html';
</script>");
}
$conn->close();
}
}
else
{
echo("<script type=\"text/javascript\">
window.alert('Enter UID!!!');
window.location.href='WELCOME.html';
</script>");
die();
}
?>
</div>
</body>
</html>