-
Notifications
You must be signed in to change notification settings - Fork 0
/
deletesales.php
96 lines (82 loc) · 2.23 KB
/
deletesales.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
87
88
89
90
91
92
93
94
95
96
<html>
<head>
<title>Sales</title>
<style>
body {
margin: 0;
font-family: Arial, Helvetica, sans-serif;
background:rgb(232, 221, 193) ;
}
.topnav {
overflow: hidden;
background-color: rgb(152, 116, 112);
height: 70px;
}
.topnav a {
float: left;
color: #f2f2f2;
text-align: center;
padding: 18px 14px 14px 0px;
text-decoration: none;
font-size: 33px;
font-weight: bold;
}
.brand {
overflow: hidden;
background-color:rgb(152, 116, 112);
float: left;
color: rgb(232, 221, 193);
text-align: left;
padding: 14px 7px 8px 15px;
text-decoration: none;
}
</style>
<body>
<div class="brand">
<a class="active" href="home.html"><img src="logo.png"></a>
</div>
<div class="topnav">
<a href="sales.php">SALES</a>
</div>
<?php
$servername = "localhost";
$username = "root";
$password = "";
$dbname = "Petshop_management";
// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
//echo " CONNECTION ESTABLISHED \r\n";
//echo " INSERTION IN PROCESS";
$id=$_POST["t1"];
$cs_id=$_POST["t2"];
$Query2="select count(*) from sales WHERE sd_id='$id' and cs_id='$cs_id'";
$Execute = mysqli_query($conn,$Query2);
$count = mysqli_fetch_row($Execute);
if($count[0]==1)
{
$sql = "DELETE FROM sales WHERE sd_id='$id' and cs_id='$cs_id'";
if ($conn->query($sql) == TRUE) {
echo '<div>
<h1 style="color:#404040;font-size:30px; font-family: "Roboto", sans-serif;margin:auto;">Data deleted successfully</h1>
</div>';
} else {
echo "Error: " . $sql . "<br>" . $conn->error;
}
}
else{
echo '<div>
<h1 style="color:#404040;font-size:30px; font-family: "Roboto", sans-serif;margin:auto;"> Data not found</h1>
</div>';
}
$conn->close();
?>
<form>
<button type="submit" style=" height: 50px;width: 90px;margin-left:10px;cursor:pointer;border-radius:10px;
border: 2px solid black;background-color: rgb(152, 116, 112);color:#f2f2f2;font-size:15px;" formaction="sales.php">back</button>
</form>
</body>
</html>