<?php

require("includes/check_auth_user.php");
require("includes/dbconnect.php");
include('includes/function.php');

$zdb = $_SESSION["zdbyear_" . $dbname];
$zyear = right($zdb, 4);
$mfrdate = getzdates($zyear, 'S');
$mtodate = getzdates($zyear, 'E');

$maindb = 'item';
//$trandb = 'saletran';
mysqli_select_db($conn, $zdb);

$tran = mysqli_query($conn, "select srl,code, quality from `$maindb`") or die(mysqli_error($conn));

$ctr= 0 ;
while ($gettran = mysqli_fetch_array($tran)) {
    $ctr++ ;
    $code = $gettran[code];
    
         $quality  = strtok($gettran["quality"], "/");

    
    mysqli_query($conn, "update `item` set `other` = '$quality' WHERE  code='$code'") or die(mysqli_error($conn));
}
browse('success');
?>
