<?php

require 'db.php';

$postdata = file_get_contents("php://input");
$request = json_decode($postdata);
if(isset($postdata) && !empty($postdata))
{
$val = mysqli_real_escape_string($con, trim($request->value));

if($val == 0)
{
    $sql = "UPDATE setting set shop_status = '0'";
    $result = mysqli_query($con,$sql);
    if($result)
    {
        $rows = array('shopstatus'=>"Closed",'status' => '0');
        echo json_encode($rows);
    }
}
else if ($val == 1)
{
    $sql = "UPDATE setting set shop_status = '1'";
    $result = mysqli_query($con,$sql);
    if($result)
    {
        $rows = array('shopstatus'=>"Opened",'status' => '1');
        echo json_encode($rows);  
    }
}
}

?>