001.
<meta charset=
"UTF-8"
>
002.
<!-- Bootstrap Core CSS -->
003.
<link href=
"calendar/bower_components/bootstrap/dist/css/bootstrap.min.css"
rel=
"stylesheet"
>
004.
005.
006.
<link href=
"calendar/dist/css/sb-admin-2.css"
rel=
"stylesheet"
>
007.
008.
009.
<?php
010.
011.
include
(
'database.php'
);
012.
013.
014.
if
(
$_POST
[
"id"
]==
''
){
015.
echo
"<script type='text/javascript'>"
;
016.
echo
"alert('Error Contact Admin !!');"
;
017.
echo
"window.location = 'index.php'; "
;
018.
echo
"</script>"
;
019.
}
020.
if
(trim(
$_POST
[
"Remark"
]) ==
""
)
021.
{
022.
echo
"กรุณาระบุหัวข้อการประชุม!"
;
023.
exit
();
024.
}
025.
026.
if
(trim(
$_POST
[
"UserQTY"
]) ==
""
)
027.
{
028.
echo
"กรุณารุะบุจำนวนผู้เข้าร่วมประชุม!"
;
029.
exit
();
030.
}
031.
032.
033.
034.
$sql1
=
"SELECT * FROM booking WHERE Booking_id ='"
.
$_POST
[
"id"
]."'
035.
and
date
=
'".$_POST["Date"]."'
and
MeetingRoom =
'".$_POST["MeetingRoom"]."'
036.
and
(
037.
(TimeStart BETWEEN
'".$_POST["TimeStart"]."'
and
'".$_POST["TimeEnd"]."'
)
038.
or
039.
(TimeEnd BETWEEN
'".$_POST["TimeStart"]."'
and
'".$_POST["TimeEnd"]."'
)
040.
or
041.
(
'".$_POST["TimeStart"]."'
BETWEEN TimeStart
and
TimeEnd )
042.
or
043.
(
'".$_POST["TimeEnd"]."'
BETWEEN TimeStart
and
TimeEnd )
044.
)";
045.
046.
047.
048.
049.
050.
$objQuery
= mysqli_query(
$conn
,
$sql1
);
051.
$objResult
= mysqli_fetch_array(
$objQuery
);
052.
if
(
$objResult
)
053.
{
054.
055.
echo
"<div class='container'>"
;
056.
echo
"<div style='margin-top:150px; font-size:32px;color:#00F' class='row'>"
;
057.
echo
"<div class='col-lg-12'><center>วันและเวลาที่จองห้องของคุณ <span style='color:red'>ถูกจองไปแล้ว!</span></center><br><center><a href=\"javascript:history.go(-1)\" class='btn btn-info' role='button'>กลับไป</a></center>"
;
058.
echo
"</div>"
;
059.
echo
"</div>"
;
060.
061.
echo
"</div>"
;
062.
echo
"</div>"
;
063.
064.
065.
}
066.
else
067.
{
068.
069.
070.
071.
$id
=
$_POST
[
'id'
];
072.
$Date
=
$_POST
[
'Date'
];
073.
$MeetingRoom
=
$_POST
[
'MeetingRoom'
];
074.
$Remark
=
$_POST
[
'Remark'
];
075.
$emp_code
=
$_POST
[
'emp_code'
];
076.
$UserQTY
=
$_POST
[
'UserQTY'
];
077.
$TimeStart
=
$_POST
[
'TimeStart'
];
078.
$TimeEnd
=
$_POST
[
'TimeEnd'
];
079.
080.
081.
082.
$sql
= "UPDATE booking SET
083.
Date
=
'$Date'
,
084.
MeetingRoom=
'$MeetingRoom'
,
085.
Remark=
'$Remark'
,
086.
emp_code=
'$emp_code'
,
087.
UserQTY=
'$UserQTY'
,
088.
TimeStart=
'$TimeStart'
,
089.
TimeEnd=
'$TimeEnd'
090.
WHERE Booking_id =
$id
";
091.
092.
$result
= mysqli_query(
$conn
,
$sql
)
or
die
(mysqli_error(
$conn
) .
"<br>$sql"
);
093.
094.
mysqli_close(
$conn
);
095.
096.
097.
098.
if
(
$result
){
099.
echo
"<script type='text/javascript'>"
;
100.
echo
"alert('Update Succesfuly');"
;
101.
echo
"window.location = 'index.php'; "
;
102.
echo
"</script>"
;
103.
}
104.
else
{
105.
echo
"<script type='text/javascript'>"
;
106.
echo
"alert('Error back to Update again');"
;
107.
echo
"window.location = 'showmember.php'; "
;
108.
echo
"</script>"
;
109.
}
110.
}
111.
?>