从一个表中获取数量并使用php从另一个表中减去数量

时间:2014-06-19 01:04:26

标签: php mysql

<?php
include ("../database.php");
include ("../session.php");
include ("../Utype.php");
$SEARCH=$_POST["SEARCH"];
$BARCODE=$_POST["BARCODE"];
if (isset($SEARCH))
    {
        $sql2=mysql_query("SELECT * FROM stock_count_tb ");
        while($row=mysql_fetch_array($sql2))
            {
                $sql3=mysql_query("SELECT * FROM product_stock_fullsum ");
                while($row1=mysql_fetch_array($sql3))
                    {
                        $CORRECTQTY=$row1['Qty']-$row['QTY'];
                        $Prod_ID=$row['ST_PRODUCT_ID'];
                        $sql5=mysql_query("INSERT INTO `product_stock_correctstock` (`Prod_ID`, `Qty`, `Free`, `PO_ID`, `Expire_Date`) 
                                           VALUES ('$Prod_ID', '$CORRECTQTY', '0', '', '00:00:0000');");

                    }       
            }
    }
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Untitled Document</title>
    <link href="../css/style1.css" rel="stylesheet" type="text/css" />
    <link href="BrightSide.css" rel="stylesheet" type="text/css" />
    <script src="../jquerylib.js"></script>
  </head>
  <body>
    <form action="Sales_deduct_stock.php" name="foo" method="POST">
      <table width="700" border="0">
        <tr><th width="183" scope="row"><div align="right" class="style12">ENTER PRODUCT BARCODE :</div></th>
          <th width="501" scope="row"><div align="left"><label><input name="SEARCH" type="submit" class="button" id="SEARCH" value="ADD TO STOCK" /></label></div></th></tr>
    </form>
  </body>
</html>

0 个答案:

没有答案