<?php

$r = array();
require_once __DIR__ . '/db_config.php';


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

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

$query="SELECT substatus_id,name 
        FROM defect_report_status_subtype 
        WHERE companyname='$canme' AND delete_status=0 AND view=0 AND status='completed'";
        
$result = mysqli_query($con,$query);
if(!empty($result) && mysqli_num_rows($result) > 0){
    while ($row = mysqli_fetch_array($result,MYSQLI_ASSOC)) {
        array_push($r, $row);
    }
}
mysqli_close($con);               
}
echo json_encode($r);

?>