function getPlanned($token, $studentId, $semester, $year) { $result = array(); try { if (!validateToken($token, $studentId)) { return 403; } if (empty($studentId)) { return 404; } $conn = new PDO(DBCONNECTSTRING, DBUSER, DBPASSWORD); $sql = 'SELECT * FROM course_records,courses WHERE type=2 AND courseId=courses.id AND studentId=:stuId AND semesterCode=:semester AND year=:year'; $stmt = $conn->prepare($sql); $stmt->bindParam(':stuId', $studentId); $stmt->bindParam(':semester', $semester); $stmt->bindParam(':year', $year); $stmt->execute(); $courses = $stmt->fetchAll(); //echo "Hello"; //echo $stmt->rowCount(); if ($stmt->rowCount() <= 0) { return $result; } foreach ($courses as $course) { /*echo "<p>json:"; echo print_r($course); echo "</p>"; */ $c = new stdClass(); $c->id = $course['id']; $c->dept = $course['dept']; $c->num = $course['num']; $c->type = $course['type']; $c->reqId = $course['reqId']; $c->proposedReqId = $course['proposedReqId']; $c->plannedSemester = $course['semesterCode']; $c->plannedSemesterName = getSemesterName($c->plannedSemester); $c->plannedYear = $course['year']; $result[] = $c; } $jsonResult = json_encode($result); /*echo "<p>json:"; echo $jsonResult; echo "</p>"; */ //json_encode } catch (PDOException $e) { //echo $sql . "<br>" . $e->getMessage(); return 500; } $conn = null; return $jsonResult; }
if (isset($_POST['employeeNetId'])) { $employeeNetId = $_POST['employeeNetId']; } elseif (isset($_POST['employeeReviewedNetID'])) { $employeeNetId = $_POST['employeeReviewedNetID']; } else { $employeeNetId = $netID; } try { $employeeQuery = $db->prepare("SELECT * FROM employee WHERE `netID` = :netId LIMIT 1"); $employeeQuery->execute(array(':netId' => $employeeNetId)); } catch (PDOException $e) { exit("error in query"); } $employeeReviewed = $employeeQuery->fetch(PDO::FETCH_ASSOC); //textual representation of the semester name $semesterName = getSemesterName(date("Y-m-d")); $curPeriod = getSemester(date("Y-m-d")); try { $semestersQuery = $db->prepare("SELECT * FROM scheduleSemesters WHERE semester = :period AND `area` = :area"); $semestersQuery->execute(array(':period' => $curPeriod, ':area' => $area)); } catch (PDOException $e) { exit("error in query"); } $period = $semestersQuery->fetch(PDO::FETCH_ASSOC); $start = $period['startDate']; $end = $period['endDate']; ?> <link rel="stylesheet" type="text/css" href="ticketStyle.css" /> <link rel="stylesheet" type="text/css" href="ticketReviewStats.css" /> <style type="text/css"> .tableCenter