-
Notifications
You must be signed in to change notification settings - Fork 1
/
save_sched.php
61 lines (39 loc) · 1.41 KB
/
save_sched.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
<?php
include ('connectDB.php');
$nurse=$_POST['nurse'];
$patient=$_POST['patient'];
$date_time=$_POST['date_time'];
$meds=$_POST['meds'];
$Endorsement=$_POST['Endorsement'];
$nurse_name;
$p_name;
$ward;
$room;
$bed;
$sql = "SELECT * FROM account WHERE userID = '$nurse'";
$result = $con->query($sql);
if ($result->num_rows > 0) {
// output data of each row
while($row = $result->fetch_assoc()) {
$nurse_name=$row["f_name"] . " " . $row["l_name"];
}
}
$sql2 = "SELECT * FROM patient WHERE p_ID = '$patient'";
$result2 = $con->query($sql2);
if ($result2->num_rows > 0) {
// output data of each row
while($row2 = $result2->fetch_assoc()) {
$p_name=$row2["f_name"] . " " . $row2["l_name"];
$ward=$row2["ward_num"];
$room=$row2["room_num"];
$bed=$row2["bed_num"];
}
}
$sql3 = "INSERT INTO `sched`(`nurse_id`, `nurse_name`, `patient_id`, `p_name`, `ward_num`, `room_num`, `bed_num`, `date_time` ,`meds`, `Endorsement`, `status`) VALUES ('$nurse','$nurse_name','$patient','$p_name','$ward','$room','$bed','$date_time','$meds','$Endorsement','pending')";
if (mysqli_query($con, $sql3)) {
echo "Data Added successfully";
} else {
echo "Error updating record: " . mysqli_error($con);
}
mysqli_close($con);
?>