-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdatefunction.php
More file actions
60 lines (56 loc) · 1.1 KB
/
datefunction.php
File metadata and controls
60 lines (56 loc) · 1.1 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
<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<?php
if ($_SERVER["REQUEST_METHOD"] == "POST")
{
$tdate=$_POST["tdate"];
$db=mysqli_connect("localhost","root","","users");
if(!$db)
{
echo "there is a problem";
}
else
{
$query="SELECT * from buys";
$result=mysqli_query($db,$query);
if (mysqli_num_rows($result) > 0) {
// output data of each row
while($row = mysqli_fetch_assoc($result)) {
$rdate=$row["returndate"];
$quan=$row["quantity"];
$id=$row["productid"];
}
}
}
if($tdate>$rdate)
{
echo "string";
$f=0;
$query4="UPDATE buys set quantity='$f' where productid ='$id'";
$query5="UPDATE product set quantity='$quan' where id='$id'";
if (mysqli_query($db, $query4)) {
if(mysqli_query($db, $query5))
{
echo "The product has been returned";
}
}
}
else
{
('location:index.html');
}
}
?>
<body>
<form method="post" action="<?php htmlspecialchars($_SERVER["PHP_SELF"]); ?>">
Today's date<input type="date" name="tdate">
<input type="submit" name="submit">
</form>
<form method="post" action="index.html">
<input type="submit" name="name" value="back">
</form>
</body>
</html>