<?php

include "../root.class.php";

$db = new db_safeguard();

$res = $db->query("order_items", "SELECT * FROM `order_items` WHERE `stock_type` = 3");
if ($res->num_rows > 0) {
    while ($data = $res->fetch_assoc()) {
        $stock_id = $data['stock_id'];
        $db->query("stock", "UPDATE `stock` SET `stock_type` = 3 WHERE `record_id` = '$stock_id'");
    }
} else {
    echo "No data found";
}