-
Notifications
You must be signed in to change notification settings - Fork 0
/
del.php
45 lines (38 loc) · 889 Bytes
/
del.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
<?php
$val = sizeof($_GET);
if($val==0)
{
echo "<script>location.href='login.html'</script>";
}
?>
<?php
$val = $_GET["key"];
$pro = $_GET["pro"];
$pr = $_GET["pr"];
$conn = new mysqli("localhost","root","","rural");
if($conn -> connect_error)
{
echo "ERROR";
}
$sql1 = "SELECT `product`,`price` FROM `products` WHERE username='$val';";
$table = mysqli_query($conn,$sql1);
$n = mysqli_num_rows($table);
while($n!=0)
{
$row = mysqli_fetch_assoc($table);
if($row["product"]==$pro && $row["price"]==$pr)
{
$sql2 = "DELETE FROM products WHERE `price`='$pr' AND `product`='$pro';";
if(mysqli_query($conn,$sql2))
{
echo "<script>location.href='proinst.php?key=$val'</script>";
}
else
{
echo "error";
}
break;
}
$n-=1;
}
?>