<?php

$id = $_POST['id'];
$flaw = $_POST['flaw'];
$cat = $_POST['cat'];
$type = $_POST['type'];


//$mysqli = new mysqli("localhost","vps10082_inspect","kw8!boB#C}_d","vps10082_oliacInspections");
$mysqli = new mysqli("localhost","vps10082_inspect","kw8!boB#C}_d","vps10082_oliacInspections");

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

  if(isset($id) && isset($flaw) && isset($cat) && isset($type) ){
    $sqlDesc="INSERT INTO `inspection_description`(`id`, `Flaw Description`, `Category`, `Type`)
     VALUES ('$id','$flaw','$cat','$type')";
    $resultsqlDesc = $mysqli->query($sqlDesc);
    if( $resultsqlDesc === TRUE ){

       echo "Record updated successfully";

    }else{
         echo "Error updating record: " . $mysqli->error;
    }
  }else{
    echo "Invalid paramters";
  }



}


?>
