-
Notifications
You must be signed in to change notification settings - Fork 2
/
DeleteProduct.php
123 lines (116 loc) · 3.14 KB
/
DeleteProduct.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
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
<?php
session_start();
$name=$_SESSION['Name'];
echo "<title> Product Deletion </title>";
$db=mysqli_connect('localhost','root','','auction') or die("connection failed");
$pid=$_POST['Delete'];
$_SESSION['Product_to_delete']=$pid;
?>
<html>
<head>
<style type="text/css">
<style>
*{
margin:4px;
}
body{
margin:70px;
font-family:sans-serif;
background-color: powderblue;
}
table{
border-collapse: collapse;
}
tr,td,th{
border-style:solid;
}
input, button, textarea{
background: #2196F3;
border: none;
left: 0;
color: #fff;
bottom: 0;
border: 0px solid rgba(0, 0, 0, 0.1);
border-radius:5px;
transform: rotateZ(0deg);
transition: all 0.1s ease-out;
}
ul{
list-style-type: none;
margin: 0;
padding: 0;
overflow: hidden;
background-color: #333;
position: fixed;
top: 0;
width: 100%;
}
li{
float: left;
}
li a {
display: block;
color: white;
text-align: center;
padding: 14px 16px;
text-decoration: none;
}
li a:hover:not(.active) {
background-color: #111;
}
.active {
background-color: #4CAF50;
}
</style>
</head>
<body>
<ul>
<li><a href="Seller_portal.php">Add Product</a></li>
<li><a href="Seller_orders.php">My Orders</a></li>
<li><a href="tenders.php">Tenders</a></li>
<li><a class="active" href="myproducts.php">My Products</a></li>
<li><a href="index.php">Logout</a><li>
</ul>
<form method="POST" action="landing_page.php">
<center> <h3> This cannot be undone </h3><center>
<table>
<tr>
<th>Product Name</th>
<th>Minimum Bid</th>
<th>Maximum Bid</th>
<th>Current Bid</th>
<th>Description</th>
<th>Stock</th>
<th>Time Left</th>
</tr>
<?php
$query="SELECT * FROM product where productId=$pid;";
mysqli_query($db,$query);
$result=mysqli_query($db,$query);
while($row=mysqli_fetch_array($result)){
echo '<tr>';
echo '<td>'.$row['productName'].'</td>';
echo '<td>'.$row['minbid'].'</td>';
echo '<td>'.$row['maxbid'].'</td>';
echo '<td>'.$row['currBid'].'</td>';
echo '<td>'.$row['quantity'].'</td>';
echo '<td>'.$row['descp'].'</td>';
$d1=date_create($row['expiry']);
$d2=date_create(date('d-m-Y'));
$diff=date_diff($d2,$d1);
if($diff->format("%R%a")<0){
echo '<td>Expired<td>';
$row['productId']=-1;
}
else if($diff->format("%R%a")==0)
echo '<td>Last Day<td>';
else
echo '<td>'.$diff->format("%a").' days left<td>';
echo '</tr>';
}
echo '</table>';
mysqli_close($db);
?>
<button type='submit' name='submit' value='5'>Delete</button>
</body>
</html>