<?php
include('includes/config/config.php');
include('log_entry.php');
$plant_id = $_POST['plant_id'];
$plant_name = $_POST['plant_name'];

if (!empty($plant_id)) {
  $query = "update plant_master set plant_name = '$plant_name',modified_by = '" . $_SESSION['user_id'] . "' where plant_id = '" . $plant_id . "'";

  error_log("plant query " . $query);
} else {
  $query = "insert into plant_master (plant_name,modified_by)  values ('$plant_name','" . $_SESSION['user_id'] . "' )";

  error_log("plant query " . $query);
}
if (!$result = @mysqli_query($conn, $query)) {
  die(mysqli_error($conn));
}