-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathusedDiet.php
More file actions
72 lines (66 loc) · 2.16 KB
/
usedDiet.php
File metadata and controls
72 lines (66 loc) · 2.16 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
<html>
<head>
<title>Task3</title>
</head>
<?php // creating a database connection
$db_sid =
"(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST=LAPTOP-VQD15OIM)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = orcl.168.1.2)
)
)";
$db_user = "scott"; // Oracle username e.g "scott"
$db_pass = "1234"; // Password for user e.g "1234"
$con = oci_connect($db_user,$db_pass,$db_sid);
if($con)
{ echo "Oracle Connection Successful.";
}
else
{ die('Could not connect to Oracle: '); }
$sql_select= "Select * from DietPlan d join Food f on (d.foodid = f.foodid) join Nutrition n on (f.nutid = n.nutid)";
$query_id3 = oci_parse($con, $sql_select);
$runselect = oci_execute($query_id3);
// echo $sql_select;
echo "<br>DIET PLANS<br>";
echo "<br>";
echo "DIETPLANID"." | ";
echo "TARGETCAL"." | ";
echo "CALCOUNT"." | ";
echo "FOODID"." | ";
echo "FOODTYPE"." | ";
echo "FOOD_NAME"." | ";
echo "NUTID"." | ";
echo "PROTEINS"." | ";
echo "FATS"." | ";
echo "CARBOHYDRATES"." | ";
echo "<br>";
while($row = oci_fetch_array($query_id3, OCI_BOTH+OCI_RETURN_NULLS))
{
echo "<br>";
echo $row["DIETPLANID"]." | ";
echo $row["TARGETCAL"]." | ";
echo $row["CALCOUNT"]." | ";
echo $row["FOODID"]." | ";
echo $row["FOODTYPE"]." | ";
echo $row["FOOD_NAME"]." | ";
echo $row["NUTID"]." | ";
echo $row["PROTEINS"]." | ";
echo $row["FATS"]." | ";
echo $row["CARBOHYDRATES"]." | ";
echo "<br>";
}
?>
<body>
<form action="addDiet.php" method="post">
<label for="MEMBER_ID">Member ID:</label><br>
<input type="text" id="MEMBER_ID" name="MEMBER_ID"><br><br>
<label for="DIETPLANID">Diet Plan ID:</label><br>
<input type="text" id="DIETPLANID" name="DIETPLANID"><br>
<br>
<br>
<input type="submit" value="Enter Values"/>
</form>
</body>
</html>