<?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');

mysqli_select_db($conn, $zdb);

$getsale = mysqli_query($conn, "SELECT * from product order by name") or die(mysqli_error($conn));
while ($fsale = mysqli_fetch_array($getsale)) {

    $itemcode = $fsale['code'];
    $itemname = $fsale['name'];
    
    
    mysqli_query($conn, "UPDATE `medbill` SET `itemname`='$itemname' where `item` = '$itemcode' ") or die(mysqli_error($conn));
}
browse("Update completed successfully"); 

