-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathpayment2.php
More file actions
72 lines (63 loc) · 1.71 KB
/
payment2.php
File metadata and controls
72 lines (63 loc) · 1.71 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
61
62
63
64
65
66
67
68
69
70
71
72
<!DOCTYPE html>
<html lang="en">
<?php
$from = $_POST['from'];
$to = $_POST['to'];
?>
<head>
<meta charset="utf-8">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.1.1/css/all.min.css">
<link href="payment2.css" rel="stylesheet">
<link rel="icon" href="https://cdn-icons-png.flaticon.com/512/809/809998.png" type="image/x-icon">
<title>Car Rental - Payments</title>
<script src="https://kit.fontawesome.com/77fd9664d1.js" crossorigin="anonymous"></script>
</head>
<?php
include_once 'C:\xampp\htdocs\CarRentalSystem\once.php';
session_start();
?>
<body>
<nav class ="navbar">
<div class="logo"><a href="welcome admin.php">Car Rental <i class="fas fa-car"></i></a></div>
<ul class="menu">
<li><a href="welcome admin.php">Home</a></li>
<ul class="dropdown">
<li><a href="index.php">Log out</a></li>
</ul>
<li><a href="">About us</a></li>
</ul>
</nav>
<h1> Show Payments </h1>
<table>
<tr>
<th>Date</th>
<th>Daily Payments</th>
</tr>
<?php
$temp = $from;
while($temp <= $to)
{
$sql = "SELECT payments.Date, SUM(payments.Amount) AS ' Daily Payments' FROM
payments WHERE payments.Date = '$temp' GROUP BY payments.Date";
$result = $connect->query($sql);
if(mysqli_num_rows($result) > 0)
{
while($row = $result->fetch_assoc())
{
echo "<tr><td>" . $row["Date"]. "</td><td>" . $row["Daily Payments"] . "</td><td>";
}
}
else
{
echo "<tr><td>" . $temp . "</td><td>" . 0 . "</td><td>";
}
$temp = strtotime("+1 day", strtotime("$temp"));
$temp = date("Y-m-d",$temp);
}
?>
</table>
<footer>
<p><a href="">Contact us</a></p>
</footer>
</body>
</html>