<?php
$data = array();
$id = $_GET['id'];

$var =  str_replace(array( '[', ']' ), '', $id);


$mysqli = new mysqli("localhost","root","","inspection");

// Check connection
if ($mysqli -> connect_errno) {
  echo "Failed to connect to MySQL: " . $mysqli -> connect_error;
  exit();
}else{

    $desc = "Select * FROM inspection_description
     WHERE id IN ($var)";
    $descRes = $mysqli->query($desc);
    while($rowDesc = mysqli_fetch_array($descRes)){

      $data[] = array('id'=>$rowDesc['id'],
      'Desc'=>$rowDesc['Flaw Description'],
        'Cat'=>$rowDesc['Category']) ;

    }



    echo json_encode($data);


}


?>
