<?php

require_once __DIR__ . '/db_config.php';

$response = array();
$response["employees"] = array();

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

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

$employeeQuery="SELECT employeename,emailid FROM signupdetails WHERE companyname='$cname' AND designation!='admin' AND deleted='no'";

$employeeResult=mysqli_query($con,$employeeQuery);
if(!empty($employeeResult) && mysqli_num_rows($employeeResult) > 0){
    while ($row = mysqli_fetch_array($employeeResult,MYSQLI_ASSOC)) {
        array_push($response["employees"], $row);
    }
}
mysqli_close($con);

}

echo json_encode($response);


?>