-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathresetappointment.php
More file actions
36 lines (28 loc) · 923 Bytes
/
resetappointment.php
File metadata and controls
36 lines (28 loc) · 923 Bytes
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
<?php
session_start();
include "db_conn.php";
header('Content-Type: application/json');
$data = json_decode(file_get_contents('php://input'), true);
if (isset($data['date'])) {
$date = $data['date'];
if ($conn->connect_error) {
echo json_encode(['success' => false, 'error' => $conn->connect_error]);
exit();
}
$stmt = $conn->prepare("DELETE FROM overall_appointments WHERE Date = ?");
if ($stmt === false) {
echo json_encode(['success' => false, 'error' => $conn->error]);
exit();
}
$stmt->bind_param("s", $date);
if ($stmt->execute()) {
echo json_encode(['success' => true, 'deleted' => $stmt->affected_rows]);
} else {
echo json_encode(['success' => false, 'error' => $stmt->error]);
}
$stmt->close();
$conn->close();
} else {
echo json_encode(['success' => false, 'error' => 'Date not provided']);
}
?>