Good day!
I have a problem in adding codes in my php codes, but i have the concept of codes that i want to add in my php codes, but I don't know if it is right. Kindly check my codes thank you.
I attached my whole codes for better understanding
and here is the codes I want to add:
Code:
<?php
$rexist = 0;
if($_POST["clt_no"])
{
$opname = $_POST["opname"];
$inqty = $_POST["inqty"];
$outqty = $_POST["outqty"];
$totalarr = count($opname) - 1;
for($ctr=0; $ctr < $totalarr; $ctr++)
{
$inqty[$ctr] = (float) $inqty[$ctr];
$outqtyqty[$ctr] = (float) $outqty[$ctr];
$query = "INSERT INTO clt_traceability (operation_name, input_qty, clt_transact_id) VALUES ('" . $opname[$ctr] . "', '" . $inqty[$ctr] . "', '" . $outqty[$ctr] . "', '" . $clt_transact_id . "')";
$result = mysql_query($query);
}
$query = "SELECT * FROM clt_transact WHERE clt_no = '" . $_POST["clt_no"] . "'";
$result_no = mysql_query($query);
if($result_no)
{
if(mysql_num_rows($result_no) > 0 )
{
$clicking_input = 0;
$clicking_total = 0;
$query = "SELECT t.input_qty AS clicking_input FROM clt_traceability t, p WHERE t.clt_transact_id = p.clt_transact_id AND t.operation_name '02 Clicking' AND p.clt_no='" . $_POST["clt_no"] . "'";
$resultyield = mysql_query($query);
if($resultyield)
{
if(mysql_num_rows($resultyield) > 0)$clicking_input =mysql_result($resultyield,0,"clicking_input");
}
/* $query = "SELECT SUM(t.input_qty) AS clicking_input FROM clt_traceability t, clt_transact p WHERE t.clt_transact_id = p.clt_transact_id AND t.operation_name '02 Clicking' AND p.clt_no='" . $_POST["clt_no"] . "'";
$resultyield = mysql_query($query);
if($resultyield)
{
if(mysql_num_rows($resultyield) > 0)$clicking_input =mysql_result($resultyield,0,"clicking_input");
}*/
$query = "SELECT operation_name FROM clt_traceability t, clt_transact c WHERE t.operation_name = '02 Clicking Total' AND t.clt_transact_id = c.clt_transact_id";
$result = mysql_query($query);
if($result > 0)
{
$clicking_total = $clicking_input;
//pano automatic mag eecho o mag aappear ung sum ng inqty sa inqty ng clicking total
}
}
}
}
$rexist = 0;
?>
I want to happen is all the input qty that the user insert in input qty textfield will sum and the result will appear in operation2_total in input_qty textfield.
I don't know how thus the result should be appear automatically in the input qty of operation2_total and if my code is correct.
Thank you
Bookmarks