-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgetResults.php
71 lines (68 loc) · 2.15 KB
/
getResults.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
<?php include_once "header.php";?>
<!DOCTYPE html>
<html>
<head>
<title>Database Records</title>
<link href="https://fonts.googleapis.com/css?family=Roboto&display=swap" rel="stylesheet">
<link rel="stylesheet" type="text/css" href="css/style.css">
</head>
<body>
<div class="animation-container">
<canvas id="animation-canvas"></canvas>
</div>
<?php
// Include the database configuration file
require_once 'config.php';
// Function to display table records
function displayTableRecords($tableName) {
global $conn;
$sql = "SELECT * FROM $tableName";
$result = $conn->query($sql);
if ($result->num_rows > 0) {
echo "<div class='table-container'>";
echo "<h2 style='text-align: center;'>Table: $tableName</h2>";
echo "<table>";
echo "<tr>";
// Print column names
while ($fieldInfo = $result->fetch_field()) {
echo "<th>". $fieldInfo->name. "</th>";
}
echo "</tr>";
// Print data rows
while ($row = $result->fetch_assoc()) {
echo "<tr>";
foreach ($row as $value) {
echo "<td>". $value. "</td>";
}
echo "</tr>";
}
echo "</table>";
echo "</div>";
} else {
echo "<div class='table-container'>";
echo "<p>No records found in the $tableName table.</p>";
echo "</div>";
}
}
?>
<?php
// Display records from each table
displayTableRecords("Billing");
displayTableRecords("Medication");
displayTableRecords("Patient");
?>
<div class="form-container">
<form action="addPatient.php">
<input type="submit" value="Add New Patient">
</form>
<form action="getPatient.php">
<input type="submit" value="View Patients">
</form>
</div>
<script src="js/background.js"></script>
<?php
// Close database connection
$conn->close();
?>
</body>
</html>