if ($i > 0) { echo "<h2>Total {$i} Barcode in Table primlist have been changed.</h2><br>"; } else { echo "<h2>No Barcode needs to be changed in Table primlist.</h2><br>"; } $sql = "SELECT barcode FROM inventory.tracking;"; include "connet_other_once.inc"; $result = mysql_query($sql); include "err_msg.inc"; $no = mysql_num_rows($result); $i = 0; while (list($barcode) = mysql_fetch_array($result)) { $barcode = trim($barcode); if (strlen($barcode) < 9) { if ($barcode) { $barcode0 = rlabarcode($barcode); } echo "{$barcode0}-{$barcode}-{$i}<br>"; $i++; $sql1 = "UPDATE inventory.tracking SET barcode='{$barcode0}' WHERE barcode='{$barcode}';"; $result1 = mysql_query($sql1); include "err_msg.inc"; } } if ($i > 0) { echo "<h2>Total {$i} Barcode in Table tracking have been changed.</h2><br>"; } else { echo "<h2>No Barcode needs to be changed in Table tracking.</h2><br>"; } } if ($action == "roomno") {
list($id, $loc, $yyyymmdd) = mysql_fetch_array($result); //echo "tracking id=$id loc=$loc<br>"; } //step: 2 change ownership? $temp = ''; if ($location != $loc) { ## insert data to inventory.tracking. /* table: tracking. columns: id, itemid, barcode, email_name, location, yyyymmdd, entry_id, ownnow*/ $sql = "UPDATE inventory.tracking SET ownnow='N' " . "WHERE itemid='{$itemid}' and barcode='{$barcode}';"; $result = mysql_query($sql); $filelog = __FILE__; $linelog = __LINE__; include "err_msg.inc"; $yyyymmdd = date("Ymd"); if ($barcode) { $barcode = rlabarcode($barcode); } $sql = "INSERT INTO inventory.tracking VALUES(" . "'NULL','{$itemid}', '{$barcode}', '{$ename0}', '{$location}', '{$yyyymmdd}', '{$entry_id0}', 'Y');"; //echo $sql."<br>"; $result = mysql_query($sql); if ($result) { $temp = 'y'; $action = "Inv item owner: {$itemid}."; include 'logging.inc'; } else { $temp = 'n'; } } //step: 3 message if ($temp = 'y') { echo "<h2><font color=#0000ff>The ownership of item \"{$itemid}\" has been changed to {$ename0} successfully.</font></h2>";