<?php

include '../root.class.php';

$db = new db_safeguard();

function stock($stock_id)
{
    $db = new db_safeguard();
    $res = $db->query("stock", "SELECT * FROM stock WHERE record_id = '$stock_id'");
    return $res->fetch_assoc()['description'];
}

function check_stock($stock_name)
{
    $db = new db_safeguard();
    $res = $db->query("stock", "SELECT * FROM stock WHERE `description` = '$stock_name'");
    return $res->num_rows;
}

function check_order_trans_table($stock_id)
{
    $db = new db_safeguard();
    $res = $db->query("order_trans", "SELECT * FROM order_trans WHERE stock_id = '$stock_id'");
    return $res->num_rows;
}

function check_order($order_id)
{
    $db = new db_safeguard();
    $res = $db->query("orders", "SELECT * FROM orders WHERE record_id = '$order_id'");
    return $res->num_rows;
}




