<?php
if(isset($_POST["empId"])){
    $empId=$_POST["empId"];
    $date=$_POST["selectedDate"];
    $obj=new ImageDetails($empId,$date);
}

class ImageDetails{

    function __construct($empId,$date){
           // ******************connection need to be change in server ********************************//
       // $this->db=new mysqli("localhost", "root", "", "fta");
        $this->db=new mysqli("localhost", "root", "", "fta new");
        $this->fetchImgDetails($empId,$date);
   }

    function fetchImgDetails($empId,$date){
        $imageDeleteStatus="false";
        $query=$this->db->prepare("SELECT `IMAGE_URL`, `BILL_TITLE`, `AMOUNT` FROM `fta-app-images` WHERE `EMP_ID`=? AND `DATE`=? AND `IMAGE_DELETED`=?");
        $query->bind_param("sss",$empId,$date,$imageDeleteStatus);
        $query->execute();
        $query->bind_result($imageUrl,$billTitle,$amount);
        $query->store_result();
        $return_arr=array();
        if($query->num_rows()>0){

            while($query->fetch()){
                $return_arr[] =
                array(
                    "imageUrl" => $imageUrl,
                    "billTitle" => $billTitle,
                    "amount" => $amount);


            }

            echo  json_encode($return_arr);
        }else{
            echo json_encode($return_arr);
        }

    }

}

?>
