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

        }       

ok..already got it..

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.