<?php
class ClassSubject
{
    public $connLink;
    function __construct($url="../manage/connection.php")
    {
        $this->connLink=$url;
    }

    function addClassSubject($class_id, $fetched_id, $added_by, $time)
    {
        include $this->connLink;

        $add_subject=$connect->query("INSERT INTO class_subject (class_id, subject_id, added_by, time) 
                    VALUES('$class_id', '$fetched_id', '$added_by', '$time')");
                    return $add_subject;
    }

    function getClassSubject($id)
    {
        include $this->connLink;
        $getCs=$connect->query("SELECT * FROM class_subject WHERE id='$id'")->fetch_assoc();
        return $getCs;
    }

    function getAllClassSubjects($id)
    {
        include $this->connLink;
        $subjects=array();
        $getS=$connect->query("SELECT * FROM class_subject WHERE class_id='$id'");
        while($subject=$getS->fetch_assoc())
        {
            array_push($subjects, $subject);
        }
        return $subjects;
    } 

    function deleteClassSubject($id)
    {
        include $this->connLink;
        $getCs=$connect->query("DELETE FROM class_subject WHERE id='$id'");
         return $getCs;
    } 
     
}
?>