<?php
    include_once 'opendb.php';
    $filter="";
    $PhotoTime="1";    
    $CompID=0;
      if (isset($_POST["comp_id"]))
    {
        $CompID=$_POST["comp_id"]; 
         $filter.=" where comp_id=" . $CompID;
    }
    if($CompID==0) {        
         $response["message"] = "Error: Web Co ID invalid";
            die( json_encode($response));
    }       
    if(isset($_POST["PhotoTime"])){
        $PhotoTime=$_POST["PhotoTime"];
    }
    $filter.=" and photo_edit_time > ".$PhotoTime;    
    $filter.=" order by photo_edit_time ";    
    $Qry="SELECT prod_code,photo_edit_time from products ";
    $Qry.=$filter;
   // die($Qry);
    if ($result = mysqli_query ($conn,$Qry))
    {
        if (mysqli_num_rows($result) > 0)
        {
                $response = array();
                while ($row = mysqli_fetch_array($result,MYSQLI_ASSOC))
                {
                    $request = array();
                    $request["prod_code"] = $row["prod_code"];
                    $request["photo_edit_time"] = $row["photo_edit_time"];
                    array_push($response, $request);
                }
                echo json_encode($response);
         } else
         {   
                $response["message"] = "NoData";
                echo json_encode($response);
         }
    }
    else {
        $response["message"] = "NoData";
        echo json_encode($response); 
    }
 $conn->close();
?>