mysql - getting quantity from one table and substract from another table quantity using php -
<?php include ("../database.php"); include ("../session.php"); include ("../utype.php"); $search=$_post["search"]; $barcode=$_post["barcode"]; if (isset($search)) { $sql2=mysql_query("select * stock_count_tb "); while($row=mysql_fetch_array($sql2)) { $sql3=mysql_query("select * product_stock_fullsum "); while($row1=mysql_fetch_array($sql3)) { $correctqty=$row1['qty']-$row['qty']; $prod_id=$row['st_product_id']; $sql5=mysql_query("insert `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 stock" /></label></div></th></tr> </form> </body> </html>
php mysql
No comments:
Post a Comment