<?php


$column = $_POST['column'];
$stock_id = $_GET['stock_id'];
$row = $_POST['row'];


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

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

    $update = "UPDATE inspection_cars SET $column = CONCAT_WS(',', $column, '$row')   WHERE Stock_id=$stock_id";

    if ($mysqli->query($update) === TRUE) {

      echo "Record updated successfully";

    } else {

      echo "Error updating record: " . $mysqli->error;

    }



}


?>
