<?php
include("../../db.php");
error_reporting(E_ALL);
header("Access-Control-Allow-Origin: * ");


$abc = $_POST['json'];
// print_r($abc);

$idata = json_decode($abc, true);

$image_list = $idata['image_list'];
$session = $idata['session'];
$school_id = $idata['school_id'];

$Added_by = $idata['added_by'];


// $date=date("Y-m-d");

foreach ($image_list as $x => $x_value) {
    $aryData = array(
        "image_name" => $x_value,
        "session" => $session,
        "added_by" => $Added_by,
        "school_id" => $school_id
    );


    //print_r($aryData);
    $insert_complain = $db->insertAry(" image_calendar", $aryData);

}

if ($insert_complain > 0) {

    $msg = "Image Added successfully.!";


}


if ($msg != "") {
    echo json_encode(array('status' => 1, 'msg' => 'Done', "data" => $msg));

} else {
    echo json_encode(array('status' => 0, 'msg' => 'Gallery not Added. Please try again later..!'));
}
