|
|
|
พอจะมีวิธี รวม ข้อมูล array json ที่ใช้ บันทัด ที่ 43 ครับ ต้อง การ 2 value title=> $obj->MeetingroomName." ".TimeUse, |
|
|
|
|
|
|
|
Code (PHP)
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>prac full calendar</title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/fullcalendar/2.1.1/fullcalendar.css" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.0.0-alpha.6/css/bootstrap.css" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.18.1/moment.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/fullcalendar/3.4.0/fullcalendar.min.js"></script>
<?php
//Database
$data = array();
$link = mysqli_connect("localhost", "root", "1234", "ioonresort");
mysqli_set_charset($link, 'utf8');
if (!$link) {
echo "Error: Unable to connect to MySQL." . PHP_EOL;
echo "Debugging errno: " . mysqli_connect_errno() . PHP_EOL;
echo "Debugging error: " . mysqli_connect_error() . PHP_EOL;
exit;
}
$MT="MT01";
$query = "SELECT * FROM detailbookingmeetingroom join bookingmeetingroom using (BookingMeettingroom) join detailovertime using (DetailOverID)
join overtime using (OvertimeID) INNER JOIN meetingroom
ON detailbookingmeetingroom .MeetingroomID=meetingroom.MeetingroomID ";
if ($result = $link->query($query)) {
/* fetch object array */
while ($obj = $result->fetch_object()) {
$data[] = array(
'id' => $obj->BookingMeettingroom,
'title'=> $obj->MeetingroomName." ".TimeUse,
'start'=> $obj->DayST,
'end'=> $obj->DayEnd
);
}
/* free result set */
$result->close();
}
mysqli_close($link);
/*
$array = array(
array('title'=> 'Long Event',
'start'=> '2015-02-07',
'end'=> '2015-02-10'),
array('id'=> 999,
'title'=> 'Repeating Event',
'start'=> '2015-02-16T16:00:00')
);
*/
?>
<script>
$(document).ready(function() {
$('#calendar').fullCalendar({
header: {
left: 'prev,next today',
center: 'title',
right: 'month,basicWeek,basicDay'
},
defaultDate: '<?php echo date('Y-m-d');?>',
editable: true,
eventLimit: true, // allow "more" link when too many events
events : <?php echo json_encode($data);?>
});
});
</script>
<h3>ตารางการใช้ห้องประชุมอุ่นไอรัก 1</h2>
<div id='calendar'></div>
Tag : PHP, HTML
|
ประวัติการแก้ไข 2019-03-29 21:47:40 2019-03-29 21:47:43 2019-03-29 21:48:33
|
|
|
|
|
Date :
2019-03-29 20:45:28 |
By :
zoneteendome |
View :
610 |
Reply :
1 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ต่อ string ธรรมดาเลยครับ
'title'=> $obj->MeetingroomName." ".$obj->TimeUse,
|
|
|
|
|
Date :
2019-03-30 07:16:24 |
By :
Chaidhanan |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 04
|