At the top of your php page, add the following for error checking/debugging -
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
I have the added additional error checking for you which you should always include in your code to help you see where your code is failing -
$code = $_POST['code'];
$name = $_POST['name'];
$description = $_POST['description'];
$qty_stock = $_POST['qty_stock'];
$price = $_POST['price'];
$update_return_inventory = "UPDATE `product_list` SET qty_stock = qty_stock - $qty_stock WHERE `code` = '{$code}'";
$update_inventory_result = $this->conn->query($update_return_inventory);
if ($update_inventory_result) {
$insert_inventory_log = "INSERT INTO `inventory_log`(`code`, `name`, `description`, `qty_stock`, `price`) VALUES ('$code', '$name', '$description', '$qty_stock', '$price')";
$insert_inventory_result = $this->conn->query($insert_inventory_log);
if ($insert_inventory_result) {
$this->settings->set_flashdata("Inventory update successfully saved.");
} else {
$this->settings->set_flashdata("Error: Inventory insert failed.");
}
} else {
$this->settings->set_flashdata("Error: Inventory update failed.");
}