SQL CASTING PROBLEM
Posted: Tue Sep 14, 2010 10:49 am
Hi i wanted to select a field called transaction amount in table transaction of debtors , and it does no seem to be able to retrieve the data correctly and i am unable to know how to do casting here is part of the script
//getting values from post/form
$customer = $_POST["customer_id"];
$amount = $_POST["amount_paid"];
$sql = "SELECT tra_outstanding FROM transaction WHERE tra_customer_id='".$customer."'";
$result = nuRunQuery($sql);
$amount_due = db_fetch_object($result);
$amount_due = $amount_due - $amount ;
nuRunQuery("UPDATE transaction SET tra_outstanding =$amount_due WHERE tra_customer_id = '".$customer."'");
please help me out to know how to do the casting
//getting values from post/form
$customer = $_POST["customer_id"];
$amount = $_POST["amount_paid"];
$sql = "SELECT tra_outstanding FROM transaction WHERE tra_customer_id='".$customer."'";
$result = nuRunQuery($sql);
$amount_due = db_fetch_object($result);
$amount_due = $amount_due - $amount ;
nuRunQuery("UPDATE transaction SET tra_outstanding =$amount_due WHERE tra_customer_id = '".$customer."'");
please help me out to know how to do the casting