0

Hi guys,

I have a table called "goodsbalance"

qtyBalanceID    |   k8goodsID   |   goodsIn |   goodsOut    |   qtyBalance
----------------------------------------------------------------------------

Can I do some calculation like this?

$query_recgoodsbalance = "SELECT * FROM goodsbalance";
$rs_recgoodsbalance = mysql_query($query_recgoodsbalance);
$rec_goodsbalance = mysql_num_rows($rs_recgoodsbalance);



while (($reck9goodsout = mysql_fetch_array($rs_recgoodsbalance) )!= false) {    

        $query_UgoodsOut = $rec_goodsbalance['goodsOut'] - $_POST['k9goodsQty'];
        $rs_UgoodsOut = mysql_query($query_UgoodsOut);
        $rec_UgoodsOut = mysql_fetch_array(rs_UgoodsOut);

        $query_Ugoodsbalance = $rec_goodsbalance['goodsBalance'] - $rec_UgoodsOut;
        $rs_Ugoodsbalance = mysql_query($query_Ugoodsbalance);
        $rec_Ugoodsbalance = mysql_fetch_array($rs_Ugoodsbalance);

        $update_recgoodsBalancek9 = "UPDATE goodsbalance SET
                                     goodsOut='".$rec_UgoodsOut['k9goodsQty']."',
                                     qtyBalance='".$rec_Ugoodsbalance['qtyBalance']."'
                                     WHERE k8goodsID='".$reck9goodsout['k8goodsID']."'";
        $rslt_recgoodsBalancek9 = mysql_query($update_recgoodsBalancek9);

        }       

Edited by sagisgirl

1
Contributor
1
Reply
18
Views
3 Years
Discussion Span
Last Post by sagisgirl
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.