-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgetHolidays.php
31 lines (24 loc) · 1.26 KB
/
getHolidays.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
<?php
require_once("./includes/database.php");
if(isset($_POST["barberid"])){
// $preparedStatement = $conn->prepare(
// " SELECT start_date, end_date FROM holiday
// WHERE barberid=?
// AND ((? BETWEEN MONTH(start_date)
// AND MONTH(end_date)
// AND YEAR(start_date)=?
// AND YEAR(end_date)=?)
// OR (YEAR(end_date)=?
// AND YEAR(end_date)>YEAR(start_date)
// AND MONTH(end_date)<=?))
// OR (YEAR(end_date)>YEAR(start_date)
// AND YEAR(start_date)=?
// AND MONTH(start_date)<=?
// )
// ");
// $preparedStatement->execute(array($_POST["barberid"],$_POST["month"],$_POST["year"],$_POST["year"],$_POST["year"],$_POST["month"],$_POST["year"],$_POST["month"]));
$preparedStatement = $conn->prepare("SELECT start_date, end_date FROM holiday WHERE barberid=?");
$preparedStatement->execute(array($_POST["barberid"]));
header('Content-Type: application/json');
echo json_encode($preparedStatement->fetchAll());
}