<?php
// array for JSON response
$response = array();
require_once __DIR__ . '/db_config.php';

if ( isset($_POST["companyname"]) && isset($_POST["email"]) ) {
    $companyname = $_POST['companyname'];
    $employeemailid = $_POST['email'];
    $con = mysqli_connect(DB_SERVER, DB_USER, DB_PASSWORD,DB_DATABASE) or die(mysql_error());
    
   $query="SELECT companyname,employeemailid,activity,timesheetdate,starttime,endtime,attendancegroup,attendancesubgroup,attendenceteam,latitude,longitude,location,dateandtime,deleted,facility_id FROM timesheet WHERE ( companyname = '$companyname' AND employeemailid = '$employeemailid' AND deleted = 'no' ) ORDER BY Id ASC "; 
  
    $result = mysqli_query($con,$query);
    
    if(!empty($result) && mysqli_num_rows($result) > 0){
        
        $response["list"] = mysqli_fetch_all($result,MYSQLI_ASSOC);
        $response["s"] = 1;
        
    }else{
        $response["s"] = 0;
    }
    mysqli_close($con);

}else {
    $response["s"] = 2;
}
    echo json_encode($response);




?>