<?php

include "../../root.class.php";
$db = new db_safeguard();
$amount = $_POST['amount'];
$type = ($_POST['type'] === '+') ? '' : '-';
$amount = $type . $amount;
$id = $db->query("stock_trans", "INSERT INTO stock_trans (`stock_id`,`amount`,`user_id`) VALUES ('{$_POST['stock_id']}','$amount','{$_SESSION['user_id']}')");
if($id > 0){
    echo "<script>location.href='bookings.php';</script>";
}