|
|
|
การดึงข้อมูลแสดงในปฎิทิน......................................... |
|
|
|
|
|
|
|
พอดีผมอยากเอาข้อมูลจาก ดาต้าเบส มาแสดงบนปฎิทิน แต่ข้อมูลไม่แสดงครับ ไม่แน่ใจว่าผิดพลาดตรงไหนครับ ขอคำแนะนำด้วยครับ
ไฟล์แสดง
<!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" />
<!--<link href="style.css" rel="stylesheet" type="text/css" media="screen" />-->
<link rel='stylesheet' type='text/css' href='fullcalendar/redmond/theme.css' />
<link rel='stylesheet' type='text/css' href='fullcalendar/fullcalendar.css' />
<link rel="stylesheet" href="fullcalendar/js/fullcalendar-2.1.1/fullcalendar.min.css">
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
<script type="text/javascript" src="fullcalendar/js/fullcalendar-2.1.1/lib/moment.min.js"></script>
<script type="text/javascript" src="fullcalendar/js/fullcalendar-2.1.1/fullcalendar.min.js"></script>
<script type="text/javascript" src="fullcalendar/js/fullcalendar-2.1.1/lang/th.js"></script>
<script type="text/javascript" src="script.js"></script>
<script type="text/javascript">
$(document).ready(function() {
var date = new Date();
var d = date.getDate();
var m = date.getMonth();
var y = date.getFullYear();
$('#calendar').fullCalendar({
header: {
left: 'prev,next today',
center: 'title',
right: 'month,agendaWeek,agendaDay'
},
editable: true,
events: "getCalendar.php?gData=1",
eventRender: function(event, element, calEvent) {
var html_data = '<img src="img/r09.gif" /><img src="img/122.gif" /><img src="img/21.gif" /><img src="img/032.gif" />';
var elem = $("<span class=\"fc-event-icons\"></span>").html(html_data);
element.find(".fc-event-title").after(elem);
}
});
$('.fc-event-icons img').live('click','img',function(event) {
alert($(this).attr('src'));
});
});
</script>
<title>t</title>
</head>
<body>
<div >
<div id='calendar' style='width:60%' ></div>
</div>
</body>
</html>
ไฟล์ดึงข้อมูล
<?php
if(isset($_GET['gData'])){
//$link = mysqli_connect("localhost", "root", "123456", "test");
$link = mysqli_connect("localhost","root","123456","test");
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;
}
$event_array=array();
$i_event=0;
$sql="SELECT * FROM tbl_event WHERE date(event_start)>='". date('Y-m-d', $_GET['start']) ."'
AND date(event_end)<='". date('Y-m-d', $_GET['end']) ."' ORDER by event_id";
echo $sql."<br/>";
if ($result = $link->query($sql)) {
while($rs = $result->fetch_assoc()){
$event_array[$i_event]['id'] = $rs['event_id'];
$event_array[$i_event]['title'] = $rs['event_title'];
$event_array[$i_event]['start'] = $rs['event_start'];
$event_array[$i_event]['end'] = $rs['event_end'];
$i_event++;
}
echo json_encode($event_array);
}
mysqli_close($link);
}
?>
Tag : Mobile, MySQL, Google Chrome
|
|
|
|
|
|
Date :
2023-05-10 09:18:01 |
By :
falcoa |
View :
343 |
Reply :
0 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 02
|