-
Notifications
You must be signed in to change notification settings - Fork 0
/
payment_history.php
62 lines (56 loc) · 1.6 KB
/
payment_history.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
<!DOCTYPE html>
<html>
<head>
<title>Transactions</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<h1>Transactions History</h1>
<table>
<thead>
<tr>
<th>ID</th>
<th>Sender</th>
<th>Receiver</th>
<th>Amount</th>
<th>Date and Time</th>
</tr>
</thead>
<tbody>
<?php
$servername = "localhost";
$username = "root";
$password = "";
$databasename = "grip";
// Create a connection to the database
$conn = new mysqli($servername, $username, $password, $databasename);
// Check if the connection was successful
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
// The SQL query to fetch the data from the database
$query = "SELECT * FROM transactions";
// Execute the query
$result = $conn->query($query);
// Check if the query was successful
if ($result->num_rows > 0) {
// Loop through the results and echo the data
while ($row = $result->fetch_assoc()) {
echo "<tr>";
echo "<td>" . $row["id"] . "</td>";
echo "<td>" . $row["sender"] . "</td>";
echo "<td>" . $row["receiver"] . "</td>";
echo "<td>" . $row["amount"] . "</td>";
echo "<td>" . $row["date and time"] . "</td>";
echo "</tr>";
}
} else {
echo "No data found";
}
// Close the connection to the database
$conn->close();
?>
</tbody>
</table>
</body>
</html>