$answeredtime = $agi->get_variable("ANSWEREDTIME"); $seconds = $answeredtime; $first = $clientfirst; $second = $clientsecond; $cost = $clientrate; $A = ( $seconds - $first ); $B = bcdiv($A, $second, 4); $C = ceil( $B ); $D = ( $C * $second ); $E = ( $D + $first ); $F = ( $cost / '60' ); $total = ( $F * $E ); $deduct = ($clienrate - $total); connect_db(); $query1 = "update airstar set credit='$deduct' where clid='$incoming_number' "; $query_result1 = @mysql_query($query1);