-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAdd_appointment_sql.php
More file actions
40 lines (29 loc) · 1.26 KB
/
Copy pathAdd_appointment_sql.php
File metadata and controls
40 lines (29 loc) · 1.26 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
<?php
session_start();
require_once 'config/db.php';
if (isset($_POST['Add_appointment_sql'])) {
$Doctor = $_POST['Doctor'];
$Patient = $_POST['Patient'];
$Appointment_date = $_POST['Appointment_date'];
$start = $_POST['start'];
$end = $_POST['end'];
// // Check if the employee name already exists in the database
// $sql_select = "SELECT patient_fname, patient_lname FROM patient_profile WHERE patient_fname = '$firstname' and patient_lname = '$lastname'";
// $result_select = $conn->query($sql_select);
// if ($result_select->num_rows > 0) {
// $_SESSION['error'] = "มีข้อมูลผู้ป่วยอยู่เเล้ว";
// header("location: Receptionist.php");
// exit();
// }
// Insert the new patient into the database
$sql_insert = "INSERT INTO appointment VALUES ('$Patient', '$Doctor', '$Appointment_date', '$start', '$end')";
$result_insert = $conn->query($sql_insert);
if (!$result_insert) {
$_SESSION['error'] = "ไม่สามารถเพิ่มข้อมูลพนักงานได้";
header("location: Receptionist.php");
exit();
}
header("location: Receptionist.php");
exit();
}
?>