我正在尝试从表“花名册”中读取数据,该名册基于登录的人从该表中获取数据,如果有人对如何执行此操作有任何想法,我已经尝试了一些方法,但是我认为他们是对的
这是我的页面,我希望将数据加载到
<?php
include('session.php');
?>
<!DOCTYPE html>
<html>
<head>
<meta charset='utf-8' />
<link href='fullcalendar.min.css' rel='stylesheet' />
<link href='fullcalendar.print.min.css' rel='stylesheet' media='print' />
<script src='js/moment.min.js'></script>
<script src='js/jquery.min.js'></script>
<script src='fullcalendar.min.js'></script>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="">
<meta name="author" content="">
<script>
$(document).ready(function () {
var calendar = $('#calendar').fullCalendar({
header: {
left: 'prev,next today',
center: 'title',
right: 'month,basicWeek,basicDay'
},
navLinks: true, // can click day/week names to navigate views
editable: true,
eventLimit: true,
events: "load_Emp_Roster.php",
displayEventTime: true,
eventRender: function (event, element, view) {
if (event.allDay === 'true') {
event.allDay = true;
} else {
event.allDay = false;
}
},
selectable: true,
selectHelper: true,
select: function (start, end, allDay) {
calendar.fullCalendar('unselect');
},
});
});
<?php
include('config1.php');
session_start();
$user_check = $_SESSION['login_user'];
$ses_sql = mysqli_query($db,"select * from emp where email = '$user_check' ");
$row = mysqli_fetch_array($ses_sql);
$login_session = $row['name'];
if(!isset($_SESSION['login_user'])){
header("location:login.php");
}
?>
下面是我的文件,我在其中从包含已登录用户名的名册表中获取数据,我认为他是我出了错的地方,但我会提出任何建议
<?php
include('session.php');
$connect = new PDO('mysql:host=localhost;dbname=paperlesspub', 'root', '');
$data = array();
$query = "SELECT * FROM roster WHERE Name = '$user_check'";
$statement = $connect->prepare($query);
$statement->execute();
$result = $statement->fetchAll();
foreach($result as $row)
{
$data[] = array(
'id' => $row["reqID"],
'title' => $row["name"],
'start' => $row["Start"],
'end' => $row["End"]
);
}
echo json_encode($data);
?>