This topic is locked

Total Field After Record Update Event

11/29/2008 9:30:30 PM
PHPRunner General questions
C
chaintm author

As you can see by my screen shot, the totals in echo are fine, however trying to save them to the total fields is wrong.

I tried Identifying the fields with " or ', but that errors out the page. Anyone ? I am missing something simple I am sure,

probably to much coding and my mind is mud <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=question&id=10290&image=1&table=forumtopics' class='bbc_emoticon' alt=':)' />


[codebox]global $data,$data1,$conn,$strTableName;

$str = "select sum(Order_sub_total) + sum(Tax_Amount) + sum(Delivery_cost) from order_sales where Order_num=".$keys["Order_num"];

$rs = db_query($str,$conn);

$data = db_fetch_numarray($rs);

$value = $data[0];
$str1 = "select sum(Order_sub_total) + sum(Tax_Amount) + sum(Delivery_cost)- sum(Amount_down) from order_sales where Order_num=".$keys["Order_num"];

$rs1 = db_query($str1,$conn);

$data1 = db_fetch_numarray($rs1);

$value1 = $data1[0];
//$values ["Total_due"] = $value1;

//$values ["Order_total"] = $value;
$strUpdate = "update order_sales set Order_total =".$value[0]." where Order_num=".$keys["Order_num"];

$strUpdate = "update order_sales set Total_due =".$value1[0]." where Order_num=".$keys["Order_num"];

db_exec($strUpdate,$conn);

echo ($value1);

echo "//__||";

echo ($value);

//** Redirect to another page ****

//header("Location: order_sales_list.php?a=return");

//exit();[/codebox]

J
Jane 12/1/2008

answered in your personal email.