<?php
$mysubjects = 0;
$myexams = 0;
$myassessment = 0;
$notice = 0;

try {
$conn = new PDO("mysql:host=$servername;dbname=$dbname;charset=utf8mb4;collation=utf8_general_ci;prefix=''", $username, $password);
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);

	
$stmt = $conn->prepare("SELECT * FROM tbl_subjects WHERE class = :myclass");
$stmt->bindParam(':myclass', $_SESSION['class']);
$stmt->execute();
$result = $stmt->fetchAll();
$mysubjects = count($result);

$stmt = $conn->prepare("SELECT * FROM tbl_exams WHERE class = :myclass AND status = 'ACTIVE'");
$stmt->bindParam(':myclass', $_SESSION['class']);
$stmt->execute();
$result = $stmt->fetchAll();
$myexams = count($result);

$stmt = $conn->prepare("SELECT * FROM tbl_asessment_records WHERE student = :me");
$stmt->bindParam(':me', $_SESSION['id']);
$stmt->execute();
$result = $stmt->fetchAll();
$myassessment = count($result);

$stmt = $conn->prepare("SELECT * FROM tbl_notice");
$stmt->execute();
$result = $stmt->fetchAll();
$notice = count($result);

}catch(PDOException $e)
{
echo "Connection failed: " . $e->getMessage();
}

?>