-
Notifications
You must be signed in to change notification settings - Fork 0
/
details_diet.php
89 lines (86 loc) · 2.84 KB
/
details_diet.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset = "UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Diet Details</title>
<link href="CSS/lists.css" rel="stylesheet" type="text/css">
<link href="CSS/main.css" rel="stylesheet" type="text/css">
</head>
<body bgcolor="#E7FBFC">
<div class="PatientMedAd" id="header">
<h1>
Patient Med Administration
</h1>
</div>
<div id="Naviagation">
<?php
include('nav_bar.php');
?>
</div>
<div id="wrap_list" class="listing">
<h1> Diet Details </h1>
<?php
// ID of Patient selected
$id = (int) $_GET['id'];
// Establish odbc connection
$conn = odbc_connect('z5262083','' ,'' ,SQL_CUR_USE_ODBC);
if (!$conn) {
odbc_close($conn);
exit("Connection Failed: ".odbc_errormsg());
}
// Fetch and display detailed diet information in a table
$sql = "SELECT * FROM Diet where ID = $id";
$rs = odbc_exec($conn,$sql);
echo odbc_errormsg($conn);
echo "<table class='details-styled-table'>
<colgroup>
<col span='1' style='width: 7%;'>
<col span='1' style='width: 20%;'>
<col span='1' style='width: 13%;'>
<col span='1' style='width: 20%;'>
<col span='1' style='width: 20%;'>
<col span='1' style='width: 20%;'>
</colgroup>
<tr>
<th>ID</th>
<th>Diet Name</th>
<th>Amount/Day</th>
<th>Round1</th>
<th>Round2</th>
<th>Round3</th>
</tr>";
while($row = odbc_fetch_array($rs)) {
echo "<tr>";
echo "<td>" . $row['ID']. "</td>";
echo "<td>" . $row['DietName']. "</td>";
echo "<td>" . $row['Amount/Day']. "</td>";
// Display true/false value in readable text
if ($row['Round1'] == 1) {
echo "<td>Recommended</td>";
} else {
echo "<td>Not Recommended</td>";
}
if ($row['Round2'] == 1) {
echo "<td>Recommended</td>";
} else {
echo "<td>Not Recommended</td>";
}
if ($row['Round3'] == 1) {
echo "<td>Recommended</td>";
} else {
echo "<td>Not Recommended</td>";
}
echo "</tr>";
}
echo "</table>";
odbc_close($conn);
?>
</div>
<div id="Footer">
<?php
include('footer.php');
?>
</div>
</body>
</html>