<?php

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


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

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


$query="SELECT id,image_path,type,incharge_name,incharge_number FROM defect_report_image WHERE report_id='$id' AND delete_status=0 
AND companyname='$canme'";

$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);

?>