<?php
include("../../db.php");
/*
$class = $_REQUEST['class'];
$section = $_REQUEST['section'];
$session = $_REQUEST['session'];
*/
$data = json_decode($_REQUEST['data'], true);

$status = 0;
$msg = '';

// 	$db->delete("time_table","where class='".$class."' and section='".$section."'  and session='".$session."'");

foreach($data as $d1){
    $id = $d1['id'];
    // print_r($d1);
    $saveAry=array(
        //"class"     => $class,
        //"section"   => $section,
        "subject"   => $d1['subject'],
        "teacher"   =>$d1["teacher_id"]
        //"day"       => $d1['day'],
        //"class_period" => $d1['class_period'],
        //"session"   => $session,
        //"school_id" => 1,
        //"added_by"  => 1,
    );
    $flgIn=$db->updateAry("time_table", $saveAry, "where id=$id ");

}

if($flgIn > 0)
{
    $status = 1;
    $msg = 'Updated Successfully';
}

echo json_encode(array("status"=>$status, "msg"=> "$msg" ));

?>