-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdebitcard.php
108 lines (101 loc) · 3.35 KB
/
debitcard.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Debit Card Transactions</title>
<style>
body {
font-family: Arial, sans-serif;
margin: 0;
padding: 0;
background-color: #f8f9fa;
color: #333;
}
header {
background-color: #007bff;
color: #fff;
padding: 20px 0;
text-align: center;
}
section {
padding: 40px;
background-color: #fff;
box-shadow: 0 2px 10px rgba(0,0,0,0.1);
border-radius: 8px;
margin: 40px auto;
max-width: 800px;
}
table {
width: 100%;
border-collapse: collapse;
margin-top: 20px;
}
table, th, td {
border: 1px solid #ddd;
}
th, td {
padding: 12px;
text-align: left;
}
th {
background-color: #007bff;
color: #fff;
}
</style>
</head>
<body>
<header>
<h1>Debit Card Transactions</h1>
</header>
<section>
<table>
<thead>
<tr>
<th>Customer ID</th>
<th>Card Number</th>
<th>Expiration Date</th>
<th>Card Holder Name</th>
<th>Amount</th>
</tr>
</thead>
<tbody id="debitCardTableBody">
<?php
// Database connection parameters
$servername = "localhost";
$username = "root";
$password = "prem";
$dbname = "project1";
// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
// SQL query to fetch debit card data from DebitCard table
$sql = "SELECT custumer_id, cardnumber, expidate, cardholdername, amount FROM DebitCard";
// Execute SQL query
$result = $conn->query($sql);
// Check if there are rows in the result set
if ($result->num_rows > 0) {
// Output data of each row
while ($row = $result->fetch_assoc()) {
echo "<tr>";
echo "<td>" . $row["custumer_id"] . "</td>";
echo "<td>" . $row["cardnumber"] . "</td>";
echo "<td>" . $row["expidate"] . "</td>";
echo "<td>" . $row["cardholdername"] . "</td>";
echo "<td>" . $row["amount"] . "</td>";
echo "</tr>";
}
} else {
echo "<tr><td colspan='5'>No debit card transactions found</td></tr>";
}
// Close the database connection
$conn->close();
?>
</tbody>
</table>
</section>
</body>
</html>