<?php
require_once __DIR__ . '/db_config.php';
$r = array();
$r["list"]= array();

if (isset($_POST["mail"]) ) {
 $email=$_POST["mail"];

$con = mysqli_connect(DB_SERVER, DB_USER, DB_PASSWORD,DB_DATABASE) or die(mysql_error());

$query="SELECT assignschedule_id,assigndate,f.sitename,sc.category_name
    FROM scheduleassigndate s
    INNER JOIN atmdetails f ON f.Id = s.facilityid
    INNER JOIN combination c ON c.ID = s.combinationid
    INNER JOIN service_category sc ON sc.id = c.service_category
    WHERE status='completed' AND empemailid='$email' 
    ORDER BY s.id DESC";

    mysqli_query($con,'SET CHARACTER SET utf8');

    $result=mysqli_query($con,$query);
    if(!empty($result) && mysqli_num_rows($result) > 0){
        $r["list"] = mysqli_fetch_all($result,MYSQLI_ASSOC);
    }
}
echo json_encode($r);


?>